rt,不知道为啥
#include <bits/stdc++.h>
using namespace std;
const int N = 5e5 + 5;
#define gc() (p1==p2&&(p2=(p1=buf)+fread(buf,1,1<<20,stdin),p1==p2)?EOF:*p1++)
char *p1, *p2, buf[1 << 20 + 5];
inline int read() {int x = 0, f = 1;char c = gc();while (!isdigit(c)) {if (c == '-') f = -1;c = gc();}while (isdigit(c)) {if (c == '-')f = -1;x = x * 10 + (c ^ 48);c = gc();}return x * f;}
int n;
int y[N], r[N];
int main() {
n = read();
for (int i = 1; i <= n; i ++ ) y[i] = read(), r[i] = read();
int T;T = read();
while (T -- ) {
int a, b, s = -1, t = -1, maxx = -1;
a = read(), b = read();
if (a >= b) {
puts("false");
continue;
}
for (int i = 1; i <= n; i ++ ) {
if (y[i] == a) s = i;
if (y[i] == b) t = i;
if (s != -1 && t != -1) break;
}
if (s != -1 && t != -1) {
bool fl = 1;
for (int i = s + 1; i <= t; i ++ ) maxx = max(maxx, r[i]);
for (int i = s + 1; i <= t; i ++ ) if (y[i] != y[i - 1] + 1) {fl = 0;break;}
if (maxx > r[t]) puts("false");
else if (fl) puts("true");
else puts("maybe");
continue;
}
if (t == -1) {
if (s == -1) {
puts("maybe");
continue;
}
int now;
for (int i = s + 1; i <= n; i ++ ) {
if (y[i + 1] > b) break;
maxx = max(maxx, r[i]);
now = i;
}
if (r[now] <= maxx) puts("false");
else puts("maybe");
continue;
}
if (s == -1) {
for (int i = t - 1; i >= 1; i -- ) {
if (y[i - 1] < a) break;
maxx = max(maxx, r[i]);
}
if (r[t] <= maxx) puts("false");
else puts("maybe");
}
}
return 0;
}