//土尔逊Torson 编写于2023/4/6 #define _CRT_SECURE_NO_WARNINGS #include <iostream> #include <cstdio> #include <vector> #include <algorithm> #include <stdlib.h> using namespace std; struct ant { int pos; int direct; //bool onStick; bool isA; }; bool comp(ant a, ant b) { return a.pos < b.pos; } int main() { int n; struct ant * Ant; while (scanf("%d", &n) != EOF) { Ant = (struct ant *)malloc(n * sizeof(struct ant)); int LockPos = 0; for (int i = 0; i < n; ++i) { scanf("%d%d", &Ant[i].pos, &Ant[i].direct); if (0 == Ant[i].direct) { Ant[i].isA = true; LockPos = Ant[i].pos; } //Ant[i].onStick = true; } vector<int>left, right; sort(Ant, Ant + n, comp); for (int k = 0; k < n; ++k) { if (Ant[k].pos < LockPos && Ant[k].direct == 1) { left.push_back(Ant[k].pos); } if (Ant[k].pos > LockPos && Ant[k].direct == -1) { right.push_back(Ant[k].pos); } } if (left.size() == right.size()) { printf("Cannot fall!"); } else if (left.size() > right.size()) { printf("%d", 100 - left[left.size() - right.size() - 1]); } else { printf("%d", right[left.size()]); } } //printf("LockPos = %d\n", LockPos); //for (int t = 0; t < n; ++t) //{ // printf("Ant[%d].pos, pos = %d, direct = %d, isA = %d \n", t, Ant[t].pos, Ant[t].direct, Ant[t].isA); //} system("pause"); return EXIT_SUCCESS; } // 64 位输出请用 printf("%lld")