救救孩子吧!!!
  • 板块灌水区
  • 楼主BK小鹿
  • 当前回复8
  • 已保存回复8
  • 发布时间2024/12/3 22:25
  • 上次更新2024/12/4 16:24:04
查看原帖
救救孩子吧!!!
1345783
BK小鹿楼主2024/12/3 22:25

rt,降雨量的暴力我改了一周还是全WA。。。已经要疯了,求救。。。

可能有唐诗错误,别骂

#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;
}
2024/12/3 22:25
加载中...