QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#416842#8711. Tileszhoukangyang#32 211ms223948kbC++143.9kb2024-05-22 09:30:192024-05-22 09:30:19

Judging History

你现在查看的是最新测评结果

  • [2024-05-22 09:30:19]
  • 评测
  • 测评结果:32
  • 用时:211ms
  • 内存:223948kb
  • [2024-05-22 09:30:19]
  • 提交

answer

#include<bits/stdc++.h>
#define L(i, j, k) for(int i = (j); i <= (k); ++i)
#define R(i, j, k) for(int i = (j); i >= (k); --i)
#define ll long long
#define sz(a) ((int) (a).size())
#define vi vector < int >
#define me(a, x) memset(a, x, sizeof(a))
#define ull unsigned long long
#define ld __float128
#define pb emplace_back
using namespace std;
const int N = 1e6 + 7;
struct fenwt {
	int fen[N];
	fenwt() {
		me(fen, 0);
	}
	void add(int p, int w) {
		for(; p < N; p += p & -p)
			fen[p] += w;
	}
	inline int query(int p) {
		int ret = 0;
		for(; p; p -= p & -p) ret += fen[p];
		return ret;
	}
} F;
map<int,vector<pair<int,int>>>mp;
int n, m;
int x[N], y[N];
int arr[N], tot;
vector<pair<int,vector<pair<int,int>>>>vc;
bool hos[N], occ[N];
int odd[N];
struct pm {
	int perm[4];
	bool v1[4], v2[4];
	pm() {
		L(i, 0, 3)perm[i] = i, v1[i] = v2[i] = 0;
	}
};
pm operator + (pm a, pm b) {
	pm c;
	L(i, 0, 3) {
		c.perm[i] = b.perm[a.perm[i]];
		c.v1[i] = a.v1[i] | b.v1[a.perm[i]];
		c.v2[i] = a.v2[i] | b.v2[a.perm[i]];
	}
	return c;
}
pm seg[N][2][2][2]; // col.rev; val.rev; val.(col.rev)
void upd(int x) {
	L(i, 0, 1) L(j, 0, 1) L(k, 0, 1) {
		seg[x][i][j][k] = seg[x * 2][i][j][k] + seg[x * 2 + 1][i][j][k];
	}
}
struct tag {
	int a, b, c;
	tag(int A = 0, int B = 0, int C = 0) {
		a = A, b = B, c = C;
	}
};
tag operator + (tag a, tag b) {
	if(!a.a) return tag(a.a ^ b.a, a.b ^ b.b, a.c ^ b.c);
	else return tag(a.a ^ b.a, a.b ^ b.c, a.c ^ b.b);
}
tag tg[N];
void adt(int x, tag w) {
	if(w.b) L(i, 0, 1) L(k, 0, 1) swap(seg[x][i][0][k], seg[x][i][1][k]);
	if(w.c) L(i, 0, 1) L(j, 0, 1) swap(seg[x][i][j][0], seg[x][i][j][1]);
	if(w.a) L(j, 0, 1) L(k, 0, 1) swap(seg[x][0][j][k], seg[x][1][k][j]);
	tg[x] = tg[x] + w;
}
void build(int x, int L, int R) {
	if(L == R) {
		L(i, 0, 1) L(j, 0, 1) L(k, 0, 1) {
			int occ = i, hos = k;
			L(t, 0, 3) {
				int ban = 0;
				int hav_one = 0;
				int lst = t % 2, var = t / 2;
				if(occ) {
					if(hos)hav_one = 1;
					if(var == 0) lst = hos;
					else if(lst != hos) ban = 1;
					var ^= 1;
				}
				if(!occ && hos) {
					ban = 1;
				}
				if(!occ && var) {
					ban = 1;
				}
				auto &s = seg[x][i][j][k];
				s.perm[t] = lst + var * 2;
				s.v1[t] = ban;
				s.v2[t] = hav_one;
			}
		}
		return;
	}
	int mid = (L + R) >> 1;
	build(x * 2, L, mid), build(x * 2 + 1, mid + 1, R);
	upd(x);
}
void push(int x) {
	adt(x * 2, tg[x]);
	adt(x * 2 + 1, tg[x]);
	tg[x] = tag();
}
void cov(int x, int L, int R, int l, int r, tag w) {
	if(l <= L && R <= r) {
		adt(x, w);
		return;
	}
	push(x);
	int mid = (L + R) >> 1;
	if(l <= mid) cov(x * 2, L, mid, l, r, w);
	if(r > mid) cov(x * 2 + 1, mid + 1, R, l, r, w);
	upd(x);
}
int main() {
	ios :: sync_with_stdio(false);
	cin.tie(0); cout.tie(0);
	cin >> n >> m;
	L(i, 1, n) {
		cin >> x[i] >> y[i];
		++y[i];
		arr[++tot] = y[i];
		arr[++tot] = y[i] ^ 1;
		arr[++tot] = y[i] + 2;
		arr[++tot] = (y[i] ^ 1) + 2;
	}
	sort(arr + 1, arr + tot + 1);
	tot = unique(arr + 1, arr + tot + 1) - arr - 1;
	L(i, 1, n) {
		y[i] = lower_bound(arr + 1, arr + tot + 1, y[i]) - arr;
	}
	L(i, 1, n) {
		int nxt = i % n + 1;
		if(x[nxt] == x[i]) {
			mp[x[i]].pb(min(y[i], y[nxt]), max(y[i], y[nxt]));
		}
	}
	for(auto&u : mp) {
		vc.pb(u);
	}
	build(1, 1, tot);
	int ns = 0;
	L(i, 0, sz(vc) - 2) {
		int len = vc[i + 1].first - vc[i].first;
		if(len >= 3) len = len % 2 + 2;
		sort(vc[i].second.begin(), vc[i].second.end());
		for(auto&it : vc[i].second)  
			cov(1, 1, tot, it.first + 1, it.second, tag(1, 0, 0));
		L(t, 1, len) {
			cov(1, 1, tot, 1, tot, tag(0, 1, 0));
			auto dt = seg[1][0][0][0];
			int ban = dt.v1[0];
			int hav_one = dt.v2[0];
			int lst = dt.perm[0] % 2, var = dt.perm[0] / 2;
			if(var)ban = 1;
			if(ban) {
				cout << ns << '\n';
				return 0;
			}
			if(!hav_one) {
				ns = max(ns, vc[i + 1].first - len + t);
			}
		}
	}
	cout << ns << '\n';
	return 0;
} 

详细

Subtask #1:

score: 4
Accepted

Test #1:

score: 4
Accepted
time: 12ms
memory: 216072kb

input:

4 3
0 0
0 3
3 3
3 0

output:

0

result:

ok single line: '0'

Test #2:

score: 4
Accepted
time: 12ms
memory: 214180kb

input:

4 999999999
999999999 0
999999999 1000000000
0 1000000000
0 0

output:

999999998

result:

ok single line: '999999998'

Test #3:

score: 4
Accepted
time: 8ms
memory: 213964kb

input:

4 875
875 0
0 0
0 284
875 284

output:

874

result:

ok single line: '874'

Test #4:

score: 4
Accepted
time: 15ms
memory: 214180kb

input:

4 317
317 0
317 920
0 920
0 0

output:

316

result:

ok single line: '316'

Test #5:

score: 4
Accepted
time: 24ms
memory: 213952kb

input:

4 912
912 814
912 0
0 0
0 814

output:

912

result:

ok single line: '912'

Test #6:

score: 4
Accepted
time: 7ms
memory: 214140kb

input:

4 2
0 0
0 1
2 1
2 0

output:

0

result:

ok single line: '0'

Test #7:

score: 4
Accepted
time: 16ms
memory: 216016kb

input:

4 1
0 0
0 1
1 1
1 0

output:

0

result:

ok single line: '0'

Test #8:

score: 4
Accepted
time: 7ms
memory: 213952kb

input:

4 412
412 998
0 998
0 17
412 17

output:

0

result:

ok single line: '0'

Test #9:

score: 4
Accepted
time: 16ms
memory: 215984kb

input:

4 87523458
87523458 42385699
0 42385699
0 23498231
87523458 23498231

output:

87523458

result:

ok single line: '87523458'

Test #10:

score: 4
Accepted
time: 12ms
memory: 213920kb

input:

4 1
0 0
0 1000000000
1 1000000000
1 0

output:

0

result:

ok single line: '0'

Test #11:

score: 4
Accepted
time: 24ms
memory: 215972kb

input:

4 1000000000
1000000000 0
1000000000 1000000000
0 1000000000
0 0

output:

1000000000

result:

ok single line: '1000000000'

Subtask #2:

score: 9
Accepted

Dependency #1:

100%
Accepted

Test #12:

score: 9
Accepted
time: 4ms
memory: 214208kb

input:

5 29034873
29034873 13721
0 13721
0 99198237
29034870 99198237
29034873 99198237

output:

29034872

result:

ok single line: '29034872'

Test #13:

score: 9
Accepted
time: 7ms
memory: 214216kb

input:

6 999999993
2934870 21349
2934870 3423847
0 3423847
0 91827393
999999993 91827393
999999993 21349

output:

999999992

result:

ok single line: '999999992'

Test #14:

score: 9
Accepted
time: 15ms
memory: 214220kb

input:

6 401
153 409
153 751
0 751
0 909
401 909
401 409

output:

152

result:

ok single line: '152'

Test #15:

score: 9
Accepted
time: 19ms
memory: 216040kb

input:

5 726
0 286
0 315
726 315
726 122
0 122

output:

0

result:

ok single line: '0'

Test #16:

score: 9
Accepted
time: 7ms
memory: 216024kb

input:

6 999
616 129
616 311
0 311
0 529
999 529
999 129

output:

998

result:

ok single line: '998'

Test #17:

score: 9
Accepted
time: 23ms
memory: 214032kb

input:

6 3
0 0
0 4
3 4
3 2
2 2
2 0

output:

2

result:

ok single line: '2'

Test #18:

score: 9
Accepted
time: 3ms
memory: 213988kb

input:

6 3
0 0
0 2
1 2
1 3
3 3
3 0

output:

0

result:

ok single line: '0'

Test #19:

score: 9
Accepted
time: 12ms
memory: 216000kb

input:

6 717
204 1000
0 1000
0 306
548 306
717 306
717 1000

output:

716

result:

ok single line: '716'

Test #20:

score: 9
Accepted
time: 3ms
memory: 216020kb

input:

6 804
785 17
785 665
0 665
0 969
804 969
804 17

output:

784

result:

ok single line: '784'

Test #21:

score: 9
Accepted
time: 12ms
memory: 214180kb

input:

6 973
973 772
973 122
42 122
42 6
0 6
0 772

output:

972

result:

ok single line: '972'

Test #22:

score: 9
Accepted
time: 12ms
memory: 216016kb

input:

6 615
492 993
492 748
615 748
615 311
0 311
0 993

output:

492

result:

ok single line: '492'

Test #23:

score: 9
Accepted
time: 4ms
memory: 214024kb

input:

6 999
999 424
999 302
83 302
83 70
0 70
0 424

output:

82

result:

ok single line: '82'

Test #24:

score: 9
Accepted
time: 7ms
memory: 216056kb

input:

6 884
884 622
884 317
228 317
228 96
0 96
0 622

output:

228

result:

ok single line: '228'

Test #25:

score: 9
Accepted
time: 4ms
memory: 213936kb

input:

6 6
0 6
3 6
3 4
6 4
6 0
0 0

output:

2

result:

ok single line: '2'

Test #26:

score: 9
Accepted
time: 19ms
memory: 213964kb

input:

6 6
0 4
5 4
5 2
6 2
6 0
0 0

output:

4

result:

ok single line: '4'

Test #27:

score: 9
Accepted
time: 23ms
memory: 216056kb

input:

6 6
0 6
2 6
2 4
6 4
6 0
0 0

output:

6

result:

ok single line: '6'

Test #28:

score: 9
Accepted
time: 7ms
memory: 213960kb

input:

6 6
0 6
1 6
1 4
6 4
6 0
0 0

output:

0

result:

ok single line: '0'

Test #29:

score: 9
Accepted
time: 0ms
memory: 216260kb

input:

6 802
0 60
802 60
802 604
288 604
288 271
0 271

output:

0

result:

ok single line: '0'

Test #30:

score: 9
Accepted
time: 8ms
memory: 213972kb

input:

5 318
0 782
318 782
318 256
318 148
0 148

output:

318

result:

ok single line: '318'

Test #31:

score: 9
Accepted
time: 12ms
memory: 214184kb

input:

6 994
994 511
994 76
0 76
0 135
0 782
994 782

output:

994

result:

ok single line: '994'

Subtask #3:

score: 0
Runtime Error

Test #32:

score: 11
Accepted
time: 7ms
memory: 213984kb

input:

1551 1000
0 988
2 988
3 988
6 988
6 985
6 982
6 981
6 979
6 978
6 977
6 976
6 975
6 974
6 972
6 970
6 969
6 968
6 966
6 965
6 964
7 964
8 964
8 963
8 961
8 960
10 960
11 960
13 960
16 960
16 959
16 958
16 957
16 954
16 953
16 951
16 950
17 950
18 950
18 948
18 946
18 945
18 944
18 942
18 941
18 939
...

output:

164

result:

ok single line: '164'

Test #33:

score: 11
Accepted
time: 51ms
memory: 216928kb

input:

36221 1000000000
0 996776952
43916 996776952
43916 996301596
102050 996301596
102050 995243908
173144 995243908
173144 992639626
184542 992639626
184542 987461238
192474 987461238
192474 982703402
406098 982703402
406098 980100986
525272 980100986
525272 978443232
532708 978443232
532708 977775310
6...

output:

14903120

result:

ok single line: '14903120'

Test #34:

score: 0
Runtime Error

input:

193828 1000000000
0 999998938
7028 999998938
7028 999997962
20232 999997962
20232 999997052
23456 999997052
23456 999996854
30820 999996854
30820 999996798
53224 999996798
53224 999996114
55112 999996114
55112 999995972
57148 999995972
57148 999995732
59864 999995732
59864 999995618
64052 999995618
...

output:


result:


Subtask #4:

score: 19
Accepted

Test #45:

score: 19
Accepted
time: 15ms
memory: 213956kb

input:

14 6
0 1
0 3
2 3
2 4
0 4
0 6
3 6
3 7
4 7
6 7
6 5
3 5
3 2
3 1

output:

2

result:

ok single line: '2'

Test #46:

score: 19
Accepted
time: 7ms
memory: 213964kb

input:

18 9
0 2
2 2
2 1
4 1
4 0
9 0
9 2
4 2
4 4
7 4
7 3
9 3
9 6
4 6
4 5
2 5
2 4
0 4

output:

6

result:

ok single line: '6'

Test #47:

score: 19
Accepted
time: 36ms
memory: 223948kb

input:

199996 966
752 702
754 702
754 700
756 700
756 702
758 702
758 700
760 700
760 702
762 702
762 700
764 700
764 702
766 702
766 700
768 700
768 702
770 702
770 700
772 700
772 702
774 702
774 700
776 700
776 702
778 702
778 700
780 700
780 702
782 702
782 700
784 700
784 702
786 702
786 700
788 700
7...

output:

0

result:

ok single line: '0'

Test #48:

score: 19
Accepted
time: 133ms
memory: 217748kb

input:

199996 966
748 702
750 702
750 700
752 700
752 702
754 702
754 700
756 700
756 702
758 702
758 700
760 700
760 702
762 702
762 700
764 700
764 702
766 702
766 700
768 700
768 702
770 702
770 700
772 700
772 702
774 702
774 700
776 700
776 702
778 702
778 700
780 700
780 702
782 702
782 700
784 700
7...

output:

962

result:

ok single line: '962'

Test #49:

score: 19
Accepted
time: 17ms
memory: 214248kb

input:

500 916
560 975
560 526
544 526
544 708
538 708
538 585
534 585
534 879
530 879
530 612
514 612
514 907
512 907
512 571
504 571
504 976
494 976
494 746
486 746
486 922
478 922
478 667
476 667
476 913
472 913
472 623
456 623
456 890
450 890
450 609
446 609
446 905
436 905
436 705
428 705
428 816
418 ...

output:

900

result:

ok single line: '900'

Test #50:

score: 19
Accepted
time: 21ms
memory: 216048kb

input:

500 980
421 481
453 481
453 479
32 479
32 477
453 477
453 461
353 461
353 451
403 451
403 441
176 441
176 435
314 435
314 429
128 429
128 417
129 417
129 413
31 413
31 401
136 401
136 399
130 399
130 398
130 391
217 391
217 383
6 383
6 369
105 369
105 365
84 365
84 353
178 353
178 345
0 345
0 343
26...

output:

0

result:

ok single line: '0'

Test #51:

score: 19
Accepted
time: 19ms
memory: 214092kb

input:

8480 1000
410 61
410 63
410 69
410 70
410 71
410 83
410 87
410 88
410 89
410 90
410 91
410 93
410 95
410 97
410 106
410 108
410 109
410 117
410 118
410 121
410 123
410 126
410 129
410 133
410 134
410 139
410 140
410 143
410 145
410 149
410 150
410 152
410 154
410 157
410 158
410 159
410 162
410 164
...

output:

1000

result:

ok single line: '1000'

Test #52:

score: 19
Accepted
time: 19ms
memory: 216284kb

input:

500 976
590 415
590 63
604 63
604 439
612 439
612 262
614 262
614 284
624 284
624 31
636 31
636 65
646 65
646 28
648 28
648 341
656 341
656 241
666 241
666 421
670 421
670 147
684 147
684 326
688 326
688 3
696 3
696 254
708 254
708 39
712 39
712 322
726 322
726 293
728 293
728 447
740 447
740 57
748...

output:

972

result:

ok single line: '972'

Test #53:

score: 19
Accepted
time: 11ms
memory: 216028kb

input:

502 993
993 0
991 0
991 4
989 4
989 8
987 8
987 12
985 12
985 16
983 16
983 20
981 20
981 24
979 24
979 28
977 28
977 32
975 32
975 36
973 36
973 40
971 40
971 44
969 44
969 48
967 48
967 52
965 52
965 56
963 56
963 60
961 60
961 64
959 64
959 68
957 68
957 72
955 72
955 76
953 76
953 80
951 80
951 ...

output:

494

result:

ok single line: '494'

Test #54:

score: 19
Accepted
time: 4ms
memory: 216052kb

input:

500 990
261 369
383 369
383 365
45 365
45 363
341 363
341 343
78 343
78 341
78 339
105 339
105 325
19 325
19 321
113 321
113 313
74 313
74 309
272 309
272 301
3 301
3 299
191 299
191 285
103 285
103 273
460 273
460 265
153 265
153 257
278 257
278 253
129 253
129 243
283 243
283 239
11 239
11 233
254...

output:

982

result:

ok single line: '982'

Test #55:

score: 19
Accepted
time: 7ms
memory: 214036kb

input:

1213 996
960 224
960 225
960 229
960 230
960 233
960 234
960 235
960 236
960 237
960 238
960 240
960 242
960 243
960 244
960 245
960 246
960 248
960 249
960 250
960 251
960 252
960 253
960 254
960 255
960 256
960 259
960 260
960 264
960 266
961 266
962 266
962 269
962 271
962 272
962 273
962 274
962...

output:

0

result:

ok single line: '0'

Test #56:

score: 19
Accepted
time: 11ms
memory: 214020kb

input:

1583 994
357 534
356 534
355 534
354 534
354 533
354 532
353 532
353 531
353 530
351 530
349 530
349 529
349 527
349 526
348 526
348 523
348 522
348 520
348 519
347 519
347 518
347 517
346 517
346 516
346 515
346 514
345 514
344 514
343 514
342 514
342 513
342 512
340 512
339 512
338 512
338 511
338...

output:

80

result:

ok single line: '80'

Test #57:

score: 19
Accepted
time: 4ms
memory: 213924kb

input:

12 984
697 599
0 599
0 913
697 913
697 1000
761 1000
761 977
984 977
984 311
761 311
761 68
697 68

output:

696

result:

ok single line: '696'

Test #58:

score: 19
Accepted
time: 131ms
memory: 217508kb

input:

200000 984
778 694
778 696
776 696
776 698
778 698
778 700
776 700
776 702
778 702
778 704
776 704
776 706
778 706
778 708
776 708
776 710
778 710
778 712
776 712
776 714
778 714
778 716
776 716
776 718
778 718
778 720
776 720
776 722
778 722
778 724
776 724
776 726
778 726
778 728
776 728
776 730
7...

output:

968

result:

ok single line: '968'

Test #59:

score: 19
Accepted
time: 134ms
memory: 217916kb

input:

200000 964
304 754
302 754
302 752
300 752
300 754
298 754
298 752
296 752
296 754
294 754
294 752
292 752
292 754
290 754
290 752
288 752
288 754
286 754
286 752
284 752
284 754
282 754
282 752
280 752
280 754
278 754
278 752
276 752
276 754
274 754
274 752
272 752
272 754
270 754
270 752
268 752
2...

output:

952

result:

ok single line: '952'

Test #60:

score: 19
Accepted
time: 11ms
memory: 214072kb

input:

8380 1000
929 192
929 193
929 194
923 194
914 194
910 194
899 194
875 194
869 194
864 194
840 194
835 194
810 194
803 194
795 194
794 194
789 194
778 194
773 194
771 194
765 194
762 194
741 194
740 194
735 194
728 194
719 194
718 194
716 194
693 194
676 194
652 194
632 194
611 194
609 194
588 194
58...

output:

0

result:

ok single line: '0'

Test #61:

score: 19
Accepted
time: 7ms
memory: 214036kb

input:

1056 582
0 0
2 0
2 1
6 1
6 2
8 2
8 3
12 3
12 4
14 4
14 5
16 5
16 6
18 6
18 16
20 16
20 17
24 17
24 18
26 18
26 19
28 19
28 20
32 20
32 21
34 21
34 22
36 22
36 23
38 23
38 24
40 24
40 28
42 28
42 29
44 29
44 30
46 30
46 31
48 31
48 32
50 32
50 39
54 39
54 40
56 40
56 41
58 41
58 42
60 42
60 43
62 43
...

output:

582

result:

ok single line: '582'

Test #62:

score: 19
Accepted
time: 20ms
memory: 216032kb

input:

852 466
0 0
2 0
2 1
4 1
4 2
6 2
6 3
8 3
8 4
10 4
10 5
12 5
12 6
14 6
14 7
16 7
16 8
18 8
18 9
20 9
20 10
22 10
22 11
24 11
24 14
26 14
26 15
28 15
28 16
30 16
30 17
32 17
32 18
34 18
34 19
36 19
36 25
38 25
38 26
40 26
40 27
44 27
44 28
46 28
46 29
48 29
48 43
50 43
50 44
52 44
52 45
56 45
56 46
58 ...

output:

200

result:

ok single line: '200'

Test #63:

score: 19
Accepted
time: 7ms
memory: 216200kb

input:

300 558
90 579
90 519
82 519
82 877
74 877
74 859
70 859
70 970
62 970
62 602
54 602
54 917
52 917
52 665
36 665
36 983
30 983
30 721
24 721
24 969
16 969
16 932
10 932
10 1000
0 1000
0 145
10 145
10 400
16 400
16 322
24 322
24 407
30 407
30 4
36 4
36 155
52 155
52 57
54 57
54 122
62 122
62 37
70 37...

output:

0

result:

ok single line: '0'

Test #64:

score: 19
Accepted
time: 23ms
memory: 214064kb

input:

2146 36
26 411
26 412
26 413
26 414
26 415
26 417
28 417
30 417
34 417
34 418
34 419
34 420
34 421
34 422
34 424
34 425
34 427
30 427
26 427
24 427
22 427
20 427
20 428
20 429
20 430
20 431
20 432
20 434
20 435
24 435
26 435
28 435
30 435
34 435
34 437
34 439
34 440
34 441
34 442
34 443
32 443
30 44...

output:

2

result:

ok single line: '2'

Test #65:

score: 19
Accepted
time: 148ms
memory: 217384kb

input:

199996 998
764 280
764 278
766 278
766 276
764 276
764 274
766 274
766 272
764 272
764 270
766 270
766 268
764 268
764 266
766 266
766 264
764 264
764 262
766 262
766 260
764 260
764 258
766 258
766 256
764 256
764 254
766 254
766 252
764 252
764 250
766 250
766 248
764 248
764 246
766 246
766 244
7...

output:

998

result:

ok single line: '998'

Test #66:

score: 19
Accepted
time: 146ms
memory: 223608kb

input:

199996 998
544 572
544 574
546 574
546 576
544 576
544 578
546 578
546 580
544 580
544 582
546 582
546 584
544 584
544 586
546 586
546 588
544 588
544 590
546 590
546 592
544 592
544 594
546 594
546 596
544 596
544 598
546 598
546 600
544 600
544 602
546 602
546 604
544 604
544 606
546 606
546 608
5...

output:

998

result:

ok single line: '998'

Test #67:

score: 19
Accepted
time: 125ms
memory: 217232kb

input:

199996 934
262 148
264 148
264 150
266 150
266 148
268 148
268 150
270 150
270 148
272 148
272 150
274 150
274 148
276 148
276 150
278 150
278 148
280 148
280 150
282 150
282 148
284 148
284 150
286 150
286 148
288 148
288 150
290 150
290 148
292 148
292 150
294 150
294 148
296 148
296 150
298 150
2...

output:

934

result:

ok single line: '934'

Test #68:

score: 19
Accepted
time: 155ms
memory: 217716kb

input:

199996 954
762 832
760 832
760 834
758 834
758 832
756 832
756 834
754 834
754 832
752 832
752 834
750 834
750 832
748 832
748 834
746 834
746 832
744 832
744 834
742 834
742 832
740 832
740 834
738 834
738 832
736 832
736 834
734 834
734 832
732 832
732 834
730 834
730 832
728 832
728 834
726 834
7...

output:

954

result:

ok single line: '954'

Test #69:

score: 19
Accepted
time: 8ms
memory: 214028kb

input:

12 824
511 122
511 64
191 64
191 122
0 122
0 710
191 710
191 882
511 882
511 710
824 710
824 122

output:

824

result:

ok single line: '824'

Test #70:

score: 19
Accepted
time: 4ms
memory: 216264kb

input:

8 8
0 0
0 3
2 3
2 6
8 6
8 3
6 3
6 0

output:

0

result:

ok single line: '0'

Test #71:

score: 19
Accepted
time: 25ms
memory: 214088kb

input:

9604 1000
856 342
856 344
856 345
856 347
856 348
856 349
856 350
862 350
863 350
865 350
867 350
873 350
875 350
878 350
885 350
886 350
887 350
894 350
897 350
899 350
901 350
912 350
917 350
934 350
941 350
949 350
958 350
968 350
974 350
977 350
978 350
983 350
985 350
987 350
988 350
993 350
99...

output:

1000

result:

ok single line: '1000'

Test #72:

score: 19
Accepted
time: 20ms
memory: 216064kb

input:

8542 980
130 84
130 83
130 81
130 80
130 79
130 78
130 77
130 76
128 76
125 76
122 76
115 76
113 76
110 76
108 76
102 76
100 76
98 76
93 76
81 76
78 76
76 76
73 76
71 76
70 76
69 76
58 76
57 76
49 76
47 76
46 76
44 76
42 76
41 76
39 76
27 76
22 76
21 76
15 76
14 76
10 76
7 76
6 76
6 75
6 73
6 72
6 7...

output:

0

result:

ok single line: '0'

Test #73:

score: 19
Accepted
time: 20ms
memory: 214056kb

input:

1994 499
489 978
488 978
488 976
487 976
487 974
486 974
486 972
485 972
485 970
484 970
484 968
483 968
483 966
482 966
482 964
481 964
481 962
480 962
480 960
479 960
479 958
478 958
478 956
477 956
477 954
476 954
476 952
475 952
475 950
474 950
474 948
473 948
473 946
472 946
472 944
471 944
471...

output:

0

result:

ok single line: '0'

Test #74:

score: 19
Accepted
time: 8ms
memory: 214140kb

input:

20 9
0 2
0 8
4 8
4 9
6 9
6 8
8 8
8 6
6 6
6 5
4 5
4 6
2 6
2 4
8 4
8 2
9 2
9 0
7 0
7 2

output:

9

result:

ok single line: '9'

Test #75:

score: 19
Accepted
time: 11ms
memory: 214028kb

input:

12 668
424 258
424 17
610 17
610 258
668 258
668 746
610 746
610 997
424 997
424 746
0 746
0 258

output:

668

result:

ok single line: '668'

Test #76:

score: 19
Accepted
time: 7ms
memory: 214028kb

input:

14 6
0 0
0 2
1 2
1 4
2 4
2 5
3 5
3 6
6 6
6 4
3 4
3 2
2 2
2 0

output:

0

result:

ok single line: '0'

Test #77:

score: 19
Accepted
time: 3ms
memory: 213980kb

input:

8 8
0 0
0 3
2 3
2 6
8 6
8 3
6 3
6 0

output:

0

result:

ok single line: '0'

Test #78:

score: 19
Accepted
time: 7ms
memory: 213964kb

input:

28 11
0 990
8 990
8 992
11 992
11 998
9 998
9 994
7 994
7 992
5 992
5 994
3 994
3 992
2 992
2 996
4 996
4 995
6 995
6 996
8 996
8 998
6 998
6 999
4 999
4 998
2 998
2 1000
0 1000

output:

11

result:

ok single line: '11'

Test #79:

score: 19
Accepted
time: 28ms
memory: 214240kb

input:

9988 936
270 806
269 806
267 806
266 806
265 806
264 806
262 806
261 806
260 806
259 806
258 806
257 806
256 806
256 815
256 821
256 829
256 832
256 835
256 841
256 843
256 854
256 856
256 858
256 860
256 862
256 865
256 872
256 878
256 881
256 882
256 886
256 890
256 904
256 909
256 918
256 940
256...

output:

936

result:

ok single line: '936'

Test #80:

score: 19
Accepted
time: 16ms
memory: 214092kb

input:

9869 980
9 785
9 784
9 783
9 782
9 781
9 779
17 779
18 779
20 779
25 779
30 779
33 779
34 779
35 779
40 779
42 779
43 779
56 779
61 779
65 779
75 779
78 779
80 779
82 779
83 779
86 779
101 779
107 779
109 779
111 779
120 779
121 779
124 779
130 779
143 779
154 779
164 779
165 779
170 779
170 778
170...

output:

0

result:

ok single line: '0'

Test #81:

score: 19
Accepted
time: 12ms
memory: 213968kb

input:

12 810
48 395
810 395
810 817
48 817
48 912
6 912
6 553
0 553
0 113
6 113
6 32
48 32

output:

810

result:

ok single line: '810'

Test #82:

score: 19
Accepted
time: 12ms
memory: 214280kb

input:

1707 980
980 10
980 9
980 8
980 7
980 6
980 4
980 2
980 1
980 0
968 0
965 0
926 0
916 0
900 0
859 0
848 0
820 0
772 0
763 0
760 0
743 0
730 0
725 0
694 0
688 0
632 0
609 0
603 0
597 0
596 0
581 0
483 0
474 0
439 0
437 0
419 0
373 0
367 0
363 0
362 0
345 0
330 0
272 0
260 0
253 0
241 0
220 0
200 0
17...

output:

0

result:

ok single line: '0'

Test #83:

score: 19
Accepted
time: 16ms
memory: 215952kb

input:

20 974
0 508
0 202
188 202
188 94
0 94
0 18
974 18
974 94
420 94
420 202
974 202
974 508
420 508
420 792
974 792
974 984
0 984
0 792
188 792
188 508

output:

974

result:

ok single line: '974'

Test #84:

score: 19
Accepted
time: 16ms
memory: 213968kb

input:

12 1000
0 1
0 999
1 999
1 1000
999 1000
999 999
1000 999
1000 1
999 1
999 0
1 0
1 1

output:

0

result:

ok single line: '0'

Test #85:

score: 19
Accepted
time: 11ms
memory: 213984kb

input:

906 980
544 788
544 789
544 790
546 790
547 790
550 790
551 790
552 790
553 790
554 790
555 790
556 790
556 791
556 792
558 792
560 792
560 793
560 794
561 794
564 794
565 794
566 794
567 794
568 794
568 795
568 796
569 796
570 796
570 797
570 798
571 798
572 798
574 798
574 799
574 800
574 802
575 ...

output:

0

result:

ok single line: '0'

Test #86:

score: 19
Accepted
time: 23ms
memory: 216284kb

input:

8 977
977 0
321 0
321 38
0 38
0 314
506 314
506 38
977 38

output:

977

result:

ok single line: '977'

Test #87:

score: 19
Accepted
time: 20ms
memory: 214120kb

input:

1992 996
642 177
642 176
644 176
644 175
646 175
646 174
648 174
648 173
650 173
650 172
652 172
652 171
654 171
654 170
656 170
656 169
658 169
658 168
660 168
660 167
662 167
662 166
664 166
664 165
666 165
666 164
668 164
668 163
670 163
670 162
672 162
672 161
674 161
674 160
676 160
676 159
678...

output:

996

result:

ok single line: '996'

Test #88:

score: 19
Accepted
time: 12ms
memory: 216040kb

input:

12 4
0 1
0 3
1 3
1 4
3 4
3 3
4 3
4 1
3 1
3 0
1 0
1 1

output:

0

result:

ok single line: '0'

Subtask #5:

score: 0
Runtime Error

Test #89:

score: 22
Accepted
time: 51ms
memory: 219728kb

input:

199996 198506138
31225688 248200160
31225688 248291950
28995282 248291950
28995282 248200160
26764876 248200160
26764876 248291950
24534470 248291950
24534470 248200160
22304064 248200160
22304064 248291950
20073658 248291950
20073658 248200160
17843252 248200160
17843252 248291950
15612846 24829195...

output:

0

result:

ok single line: '0'

Test #90:

score: 22
Accepted
time: 59ms
memory: 221396kb

input:

199996 740789144
48843244 341844840
48843244 342042210
40702704 342042210
40702704 341844840
32562164 341844840
32562164 342042210
24421624 342042210
24421624 341844840
16281084 341844840
16281084 342042210
8140544 342042210
8140544 341450100
16281084 341450100
16281084 341647470
24421624 341647470
...

output:

0

result:

ok single line: '0'

Test #91:

score: 22
Accepted
time: 207ms
memory: 221420kb

input:

199996 198506138
31225684 248200166
31225684 248291956
28995278 248291956
28995278 248200166
26764872 248200166
26764872 248291956
24534466 248291956
24534466 248200166
22304060 248200166
22304060 248291956
20073654 248291956
20073654 248200166
17843248 248200166
17843248 248291956
15612842 24829195...

output:

198506134

result:

ok single line: '198506134'

Test #92:

score: 22
Accepted
time: 211ms
memory: 221308kb

input:

199996 740789144
48843240 341844840
48843240 342042210
40702700 342042210
40702700 341844840
32562160 341844840
32562160 342042210
24421620 342042210
24421620 341844840
16281080 341844840
16281080 342042210
8140540 342042210
8140540 341450100
16281080 341450100
16281080 341647470
24421620 341647470
...

output:

740789140

result:

ok single line: '740789140'

Test #93:

score: 0
Runtime Error

input:

199999 1000000000
1000000000 0
999999222 0
999999222 136
999984018 136
999984018 228
999973482 228
999973482 292
999971160 292
999971160 396
999964886 396
999964886 588
999959042 588
999959042 680
999955190 680
999955190 732
999927188 732
999927188 748
999913912 748
999913912 796
999912122 796
99991...

output:


result:


Subtask #6:

score: 0
Runtime Error

Test #118:

score: 0
Runtime Error

input:

200000 1000000000
1000000000 0
999990876 0
999990876 38
999972524 38
999972524 1510
999969180 1510
999969180 3734
999964780 3734
999964780 4138
999960464 4138
999960464 11052
999953728 11052
999953728 24478
999914972 24478
999914972 25892
999909864 25892
999909864 28102
999902920 28102
999902920 301...

output:


result:


Subtask #7:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%