Submission #682538

# Submission time Handle Problem Language Result Execution time Memory
682538 2023-01-16T13:22:25 Z phoenix Segments (IZhO18_segments) C++17
23 / 100
5000 ms 3688 KB
#include<bits/stdc++.h>

using namespace std;
vector<bool> us;
vector<pair<int, int>> v;
int lastans;
int main() {
	ios::sync_with_stdio(0);
	cin.tie(0);cout.tie(0);
	us.push_back(0);
	v.push_back({0, 0});
	
	int n, t;
	cin >> n >> t;
	for(int i = 1; i <= n; i++) {
		int type;
		cin >> type;
		if(type == 1) {
			int l, r;
			cin >> l >> r;
			l = (l ^ (t * lastans));
			r = (r ^ (t * lastans));
			if(l > r) swap(l, r);

			v.push_back({l, r});
			us.push_back(1);
		}
		if(type == 2) {
			int id;
			cin >> id;
			us[id] = 0; 
		}
		if(type == 3) {
			int l, r, k;
			cin >> l >> r >> k;
			l = (l ^ (t * lastans));
			r = (r ^ (t * lastans));
			if(l > r) swap(l, r);
			if(r - l + 1 < k) {
				cout << 0 << '\n';
				continue;
			}
			lastans = 0;
			for(int i = 0; i < (int)v.size(); i++) {
				if(!us[i] || v[i].second - v[i].first + 1 < k) continue; 
				lastans++;
				if(v[i].second < l + k - 1) lastans--;
				if(v[i].first > r - k + 1) lastans--;
			}
			cout << lastans << '\n';
		}
	}
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 14 ms 340 KB Output is correct
6 Correct 18 ms 384 KB Output is correct
7 Correct 9 ms 340 KB Output is correct
8 Correct 11 ms 392 KB Output is correct
9 Correct 10 ms 340 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 23 ms 340 KB Output is correct
12 Correct 27 ms 376 KB Output is correct
13 Correct 7 ms 340 KB Output is correct
14 Correct 13 ms 380 KB Output is correct
15 Correct 3 ms 340 KB Output is correct
16 Correct 4 ms 340 KB Output is correct
17 Correct 12 ms 340 KB Output is correct
18 Correct 8 ms 420 KB Output is correct
19 Correct 10 ms 340 KB Output is correct
20 Correct 10 ms 356 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5051 ms 1300 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 464 ms 976 KB Output is correct
2 Correct 416 ms 996 KB Output is correct
3 Correct 535 ms 1204 KB Output is correct
4 Correct 451 ms 1012 KB Output is correct
5 Correct 3573 ms 1536 KB Output is correct
6 Correct 4286 ms 3656 KB Output is correct
7 Correct 3943 ms 3488 KB Output is correct
8 Correct 891 ms 3592 KB Output is correct
9 Correct 587 ms 3380 KB Output is correct
10 Correct 1929 ms 3308 KB Output is correct
11 Correct 1407 ms 2968 KB Output is correct
12 Correct 1893 ms 3164 KB Output is correct
13 Correct 2404 ms 3560 KB Output is correct
14 Correct 3668 ms 2832 KB Output is correct
15 Correct 3671 ms 3176 KB Output is correct
16 Correct 3366 ms 2832 KB Output is correct
17 Correct 4257 ms 3464 KB Output is correct
18 Correct 4321 ms 3584 KB Output is correct
19 Correct 4334 ms 3548 KB Output is correct
20 Correct 4274 ms 3572 KB Output is correct
21 Correct 1843 ms 2876 KB Output is correct
22 Correct 3421 ms 3212 KB Output is correct
23 Correct 2837 ms 3688 KB Output is correct
24 Correct 3281 ms 3100 KB Output is correct
25 Correct 524 ms 2896 KB Output is correct
26 Correct 436 ms 3000 KB Output is correct
27 Correct 460 ms 2920 KB Output is correct
28 Correct 454 ms 3016 KB Output is correct
29 Correct 2586 ms 3576 KB Output is correct
30 Correct 2608 ms 3568 KB Output is correct
31 Correct 546 ms 3396 KB Output is correct
32 Correct 1921 ms 3440 KB Output is correct
33 Correct 2258 ms 3536 KB Output is correct
34 Correct 3596 ms 2984 KB Output is correct
35 Correct 2838 ms 3200 KB Output is correct
36 Correct 2079 ms 3252 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 423 ms 940 KB Output is correct
2 Correct 416 ms 1028 KB Output is correct
3 Correct 414 ms 1024 KB Output is correct
4 Correct 445 ms 1100 KB Output is correct
5 Execution timed out 5024 ms 1492 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 14 ms 340 KB Output is correct
6 Correct 18 ms 384 KB Output is correct
7 Correct 9 ms 340 KB Output is correct
8 Correct 11 ms 392 KB Output is correct
9 Correct 10 ms 340 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 23 ms 340 KB Output is correct
12 Correct 27 ms 376 KB Output is correct
13 Correct 7 ms 340 KB Output is correct
14 Correct 13 ms 380 KB Output is correct
15 Correct 3 ms 340 KB Output is correct
16 Correct 4 ms 340 KB Output is correct
17 Correct 12 ms 340 KB Output is correct
18 Correct 8 ms 420 KB Output is correct
19 Correct 10 ms 340 KB Output is correct
20 Correct 10 ms 356 KB Output is correct
21 Execution timed out 5051 ms 1300 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 3 ms 340 KB Output is correct
4 Correct 3 ms 340 KB Output is correct
5 Correct 14 ms 340 KB Output is correct
6 Correct 18 ms 384 KB Output is correct
7 Correct 9 ms 340 KB Output is correct
8 Correct 11 ms 392 KB Output is correct
9 Correct 10 ms 340 KB Output is correct
10 Correct 4 ms 340 KB Output is correct
11 Correct 23 ms 340 KB Output is correct
12 Correct 27 ms 376 KB Output is correct
13 Correct 7 ms 340 KB Output is correct
14 Correct 13 ms 380 KB Output is correct
15 Correct 3 ms 340 KB Output is correct
16 Correct 4 ms 340 KB Output is correct
17 Correct 12 ms 340 KB Output is correct
18 Correct 8 ms 420 KB Output is correct
19 Correct 10 ms 340 KB Output is correct
20 Correct 10 ms 356 KB Output is correct
21 Execution timed out 5051 ms 1300 KB Time limit exceeded
22 Halted 0 ms 0 KB -