RE求条玄壶关(20多行)
查看原帖
RE求条玄壶关(20多行)
1036180
ChampionCyan楼主2024/7/1 17:28

暴力为何RE?

玄关标准:过样例+不爆0。

#include <stdio.h>
long long cnt = 0, last = 0;
long long a[200001];
int main() {
	long long t, d;
	scanf("%lld%lld", &t, &d);
	while (t--) {
		char op;
		long long l;
		scanf("%c%lld", &op, &l);
        if (op == 'A')
			a[++cnt] = (l + last) % d;
		else {
			last = -2e9;
			for (int i = cnt - l + 1; i <= cnt; i++)
				if (last < a[i])
					last = a[i];
			printf("%d\n", last);
		}
	}
	return 0;
}
2024/7/1 17:28
加载中...