QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#290596#3096. Road ConstructionMoRanSky100 ✓7300ms13996kbC++232.4kb2023-12-25 06:01:032023-12-25 06:01:05

Judging History

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

  • [2023-12-25 06:01:05]
  • 评测
  • 测评结果:100
  • 用时:7300ms
  • 内存:13996kb
  • [2023-12-25 06:01:03]
  • 提交

answer

// Skyqwq
#include <bits/stdc++.h>

#define pb push_back
#define fi first
#define se second
#define mp make_pair

using namespace std;

typedef long long LL;
typedef pair<int, int> PII;

template <typename T> bool chkMax(T &x, T y) { return (y > x) ? x = y, 1 : 0; }
template <typename T> bool chkMin(T &x, T y) { return (y < x) ? x = y, 1 : 0; }

template <typename T> void inline read(T &x) {
    int f = 1; x = 0; char s = getchar();
    while (s < '0' || s > '9') { if (s == '-') f = -1; s = getchar(); }
    while (s <= '9' && s >= '0') x = x * 10 + (s ^ 48), s = getchar();
    x *= f;
}

const int N = 250005;

typedef pair<LL, LL> PLL;

int n, k;

PLL e[N];

LL X, d[N], t;

bool inline cmp2(PLL x, PLL y) {
	return x.se < y.se;
}

priority_queue<LL> Q;

vector<LL> B;

PLL h[N];

void inline mg(int l, int mid, int r) {
	for (int k = l, i = l, j = mid + 1; k <= r; k++) {
		if (j > r || (i <= mid && e[i].se < e[j].se)) h[k] = e[i++];
		else h[k] = e[j++];
	}
	for (int k = l; k <= r; k++) e[k] = h[k];
}

void cdq(int l, int r) {
	if (l >= r) return;
	int mid = (l + r) >> 1;
	cdq(l, mid), cdq(mid + 1, r);
	while (Q.size()) Q.pop();
	for (int i = mid + 1, j = l; i <= r; i++) {
		if (t == k) break;
		while (j <= mid && e[j].se <= e[i].se) {
			Q.push(e[j].fi + e[j].se);
			j++;
		}
		B.clear();
		while (t < k && !Q.empty() && e[i].fi + e[i].se - Q.top() <= X) {
			B.pb(Q.top()); 
			d[++t] = e[i].fi + e[i].se - Q.top();
			Q.pop();
		}
		while (B.size()) Q.push(B.back()), B.pop_back();
	}
	while (Q.size()) Q.pop();
	for (int i = r, j = mid; i > mid; i--) {
		if (t == k) break;
		while (j >= l && e[j].se > e[i].se) {
			Q.push(e[j].fi - e[j].se);
			j--;
		}
		B.clear();
		while (t < k && !Q.empty() && e[i].fi - e[i].se - Q.top() <= X) {
			B.pb(Q.top()); 
			d[++t] = e[i].fi - e[i].se - Q.top();
			Q.pop();
		}
		while (B.size()) Q.push(B.back()), B.pop_back();
	}
	mg(l, mid, r);
}

int inline chk() {
	sort(e + 1, e + 1 + n);
	t = 0;
	cdq(1, n);
	return t;
}

int main() {
	read(n), read(k);
	for (int i = 1; i <= n; i++) read(e[i].fi), read(e[i].se);
	LL l = 0, r = 4e9;
	while (l < r) {
		LL mid = (l + r) >> 1;
		X = mid;
		if (chk() >= k) r = mid;
		else l = mid + 1;
	}
	X = r - 1;
	chk();
	sort(d + 1, d + 1 + t);
	while (t < k) d[++t] = r;
	for (int i = 1; i <= k; i++)
		printf("%lld\n", d[i]);
    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 199ms
memory: 5796kb

input:

1000 250000
-120604789 -196817502
-886598573 -244132677
-962745132 -804906692
713411777 285712831
134153614 963585898
-197826361 -175333179
-565460169 908173483
896353274 -611579049
978268559 994985433
763538362 -586603692
153489873 542159586
-786666349 -869510677
990850371 -688321237
-643715889 -66...

output:

2601105
3269568
3336810
3770635
3801771
5174684
5335665
5346982
5524699
5535711
5575527
6058023
6638072
6715810
6953158
7131472
7143353
7417634
8421821
8979975
9061502
9071885
9396972
9838413
10316331
10372270
10423263
10508846
10513309
10938976
11152927
11505085
11665172
11755331
11793833
12359370
...

result:

ok 250000 lines

Test #2:

score: 0
Accepted
time: 200ms
memory: 5584kb

input:

1000 250000
618809441 -931245378
250586732 598251388
931849898 -70234205
957978002 -448056477
-449255894 414918819
-933434246 914538854
-470645291 -804464201
-759066533 -26735347
-747959815 551813767
636732980 859735028
-357750933 179740559
800090155 -367824074
141558901 949350882
-115776927 -594667...

output:

2142892
2215302
2670369
2796499
3311516
3425276
3528067
4023880
5102875
5496229
5898961
6341127
6412421
6470701
6815436
7032847
7603443
7622717
7717819
8062663
8124001
8218981
8258727
8288247
8335240
8518199
8528209
8924126
9061749
9125668
9216273
9384927
9646018
9849035
10007869
10190574
10327946
1...

result:

ok 250000 lines

Test #3:

score: 0
Accepted
time: 164ms
memory: 5616kb

input:

707 249571
-968396712 483229822
-117583656 591768103
-3960410 -866295458
-877207394 629126679
36267353 440678667
345966768 -724507959
-542091809 -332963325
-168828295 715662519
101084145 816162259
-849015578 -378827371
385151425 976747969
496492003 -372198321
-351836389 -723330551
-400235647 8837674...

output:

5605147
6110548
6219995
6294153
6434143
6570711
7568519
7728055
7738624
7931490
8776332
9307662
10288678
10502620
10546581
11037421
11258662
11391458
11445465
11867141
12357702
13475234
13637538
13959129
14031396
14454263
14521963
14554581
14746215
14973213
15279791
15294091
15375213
15527043
156852...

result:

ok 249571 lines

Test #4:

score: 0
Accepted
time: 153ms
memory: 5644kb

input:

707 249571
-1000000000 -527313439
503424942 996620077
697607066 1000000000
312556557 184486015
-570458267 -1000000000
-1000000000 -872091404
-454171781 952145923
1000000000 713337095
1000000000 922313432
-353077796 1000000000
1000000000 146015124
-1000000000 435285940
929427500 -1000000000
182759543...

output:

99977
265206
266695
302840
336912
375142
388577
409729
439268
447404
483222
665884
681501
687437
712801
730005
731551
743941
795609
856639
884586
934200
983499
1012004
1018626
1049419
1121860
1130422
1130466
1134209
1199219
1235398
1308546
1331990
1416392
1496978
1508410
1601906
1604180
1632714
1644...

result:

ok 249571 lines

Test #5:

score: 0
Accepted
time: 178ms
memory: 5648kb

input:

1000 250000
707429320 -621191749
-476942656 645067262
707438471 -621191006
707436120 -621190240
-51208702 972153422
-991552415 190684272
707435125 -621177556
-783498940 23922525
61009688 846306442
707432669 -621177654
129036650 427183804
996307923 -435650928
707426145 -621202628
707431459 -621198208...

output:

42
59
61
71
80
105
109
109
125
132
135
137
148
156
158
170
179
181
183
184
196
196
196
200
204
210
213
223
230
232
232
235
240
240
245
249
254
260
269
272
274
276
281
290
300
300
301
301
304
305
305
309
315
322
329
332
332
332
340
342
343
347
349
349
357
365
367
371
373
374
376
377
381
382
383
388
3...

result:

ok 250000 lines

Test #6:

score: 0
Accepted
time: 10ms
memory: 3692kb

input:

1000 2000
333674098 174378963
-192088652 69226413
210996123 332107788
228521548 174378963
228521548 314582363
-69410677 402209488
193470698 -316332937
-16834402 -70976987
70792723 -228705812
-16834402 244480663
228521548 349633213
246046973 -123553262
35741873 -123553262
88318148 -35926137
263572398...

output:

35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
35050850
350...

result:

ok 2000 lines

Subtask #2:

score: 6
Accepted

Test #7:

score: 6
Accepted
time: 1636ms
memory: 13920kb

input:

250000 250000
358626271 0
-366528033 0
-51892798 0
980583931 0
334671302 0
617413670 0
147317796 0
-442753280 0
-611753656 0
-277690354 0
731121276 0
-869282612 0
-39766083 0
-896429223 0
369488026 0
-714727432 0
585723228 0
-534144610 0
-262245023 0
-969975190 0
880100953 0
233794159 0
-89665821 0
...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
...

result:

ok 250000 lines

Test #8:

score: 0
Accepted
time: 1635ms
memory: 13808kb

input:

250000 250000
-428119376 0
-265496853 0
153694093 0
-492010111 0
-428007838 0
-70337837 0
-853234494 0
-567070168 0
663903936 0
109134731 0
114840728 0
-621569580 0
-533009496 0
941150895 0
806492893 0
630685352 0
-452786530 0
-34147357 0
71248759 0
-676240299 0
-948667291 0
-133026578 0
-902985121 ...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
2
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
3
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
4
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
5
6
...

result:

ok 250000 lines

Test #9:

score: 0
Accepted
time: 147ms
memory: 5624kb

input:

707 249571
27349101 0
851419291 0
-659414963 0
-176996239 0
863769147 0
819899939 0
834312866 0
283481657 0
-484628877 0
-385542338 0
-200779392 0
-652370568 0
63107155 0
-371106437 0
-82207696 0
-366194847 0
388108450 0
411461120 0
-116295132 0
172517212 0
-269671987 0
499425079 0
878621588 0
33878...

output:

5061
12062
14952
19402
23293
25045
29023
36532
38969
40434
40446
42778
50090
52798
62431
67911
73092
77982
79967
81656
84175
93466
103536
108444
113731
114985
119628
119981
129232
129832
130954
135917
147534
153050
156739
168034
168489
172912
173057
176449
180553
181070
188760
191054
191817
194419
1...

result:

ok 249571 lines

Test #10:

score: 0
Accepted
time: 1515ms
memory: 13764kb

input:

250000 250000
-4219310 0
81236006 0
777262461 0
-391044306 0
974547983 0
-519993816 0
607649561 0
-557599467 0
519521455 0
-741489100 0
151069789 0
409668105 0
-715226837 0
-133962252 0
649050910 0
-738755794 0
854106014 0
-122987003 0
-594431858 0
-277420473 0
-556074800 0
316322175 0
-437764339 0
...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 250000 lines

Test #11:

score: 0
Accepted
time: 1408ms
memory: 13868kb

input:

250000 250000
262272072 0
942396084 0
367954082 0
935867206 0
470024236 0
161783706 0
857690376 0
778729056 0
369177246 0
484129046 0
916200522 0
357441916 0
901826744 0
469950590 0
166074386 0
221568248 0
931819878 0
902031672 0
808142628 0
458839650 0
297705404 0
276360872 0
229512410 0
307458696 ...

output:

3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
3202
...

result:

ok 250000 lines

Test #12:

score: 0
Accepted
time: 1375ms
memory: 13996kb

input:

250000 250000
60897879 0
-333611649 0
128951487 0
-240747255 0
-483609231 0
-361906083 0
-273702429 0
-109634175 0
-175632975 0
-156806307 0
85541967 0
-380858625 0
-258213123 0
-166692519 0
-197068977 0
154663803 0
-468344457 0
-147709359 0
-554472891 0
59775219 0
212923053 0
-261890685 0
-34653244...

output:

3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
3402
...

result:

ok 250000 lines

Test #13:

score: 0
Accepted
time: 1216ms
memory: 13836kb

input:

249999 250000
-630579999 0
-268671998 0
-850431998 0
-228460000 0
-379935999 0
-464884000 0
-180700000 0
-546147998 0
-915279999 0
-470739998 0
-964359998 0
-705651998 0
-299463999 0
-742599999 0
-386847999 0
-527392000 0
-82755999 0
-228675998 0
-646767998 0
-307887998 0
-503799999 0
-395511998 0
-...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 250000 lines

Subtask #3:

score: 7
Accepted

Test #14:

score: 7
Accepted
time: 3750ms
memory: 11916kb

input:

250000 1
466815508 -750813561
611661837 -882676245
757875146 -555056336
-780106006 761287915
892474681 397589958
743953520 -151574921
64282308 138987534
281386350 -713331934
202373565 -850824278
-969187168 -35485422
-249775725 -52013797
-882061102 -874033251
798422755 690590135
-849042368 -445881083...

output:

6897

result:

ok single line: '6897'

Test #15:

score: 0
Accepted
time: 4588ms
memory: 11868kb

input:

250000 1
209869463 -294582138
-760195349 430601224
368355380 -533659266
818249470 -249241586
-504696243 371192451
901767328 -572565802
-515496269 423614117
-152924283 983453953
483389329 -666467948
-369413656 870667589
313496246 -571644553
800245328 522138894
195511228 -744767200
-359626735 -8017684...

output:

11492

result:

ok single line: '11492'

Test #16:

score: 0
Accepted
time: 1ms
memory: 3584kb

input:

2 1
-1000000000 1000000000
1000000000 -1000000000

output:

4000000000

result:

ok single line: '4000000000'

Test #17:

score: 0
Accepted
time: 1152ms
memory: 11952kb

input:

250000 1
715144876 0
52784585 0
337355392 0
760346493 0
-50384252 0
138951463 0
353856074 0
7089229 0
337856669 0
218221071 0
285147204 0
630896419 0
355341060 0
-36650016 0
742952558 0
362411704 0
19082187 0
-3136068 0
212673103 0
731958385 0
-42446738 0
45092056 0
590179912 0
232094760 0
722155216...

output:

3769

result:

ok single line: '3769'

Test #18:

score: 0
Accepted
time: 2544ms
memory: 11988kb

input:

249999 1
-750000125 -556000222
-910000045 -140000430
-234000383 -604000198
-46000477 -150000425
-826000087 -214000393
-254000373 -792000104
-830000085 -786000107
-526000237 -692000154
-152000424 -778000111
-302000349 -686000157
-250000375 -970000015
-234000383 -124000438
-640000180 -408000296
-31000...

output:

1999999

result:

ok single line: '1999999'

Subtask #4:

score: 20
Accepted

Dependency #3:

100%
Accepted

Test #19:

score: 20
Accepted
time: 5098ms
memory: 11916kb

input:

250000 10
40096917 184441793
733509452 -215040792
343261166 826663843
889435655 -702749307
-135029924 955382042
898690971 -638888768
-415019949 931428280
-482844680 -217311572
-272594235 -203759340
-75706754 280207570
-822160854 -398191514
-63051149 125244914
-887034070 -801837307
369109076 69751942...

output:

8901
9920
19875
20089
20565
23118
23225
25290
26130
28058

result:

ok 10 lines

Test #20:

score: 0
Accepted
time: 4726ms
memory: 11988kb

input:

250000 10
-885431377 -975758187
308209525 454990345
618112529 -870940967
-62919926 -258491670
-135225104 -106763040
156261848 652717016
-674436098 196438075
617994366 377316986
-307238114 -897464071
65318407 -253399862
165707028 -322947196
574334588 676772441
-102086030 237566786
-297205338 67540639...

output:

8229
10390
10492
11458
16758
16842
16978
17072
22229
23913

result:

ok 10 lines

Test #21:

score: 0
Accepted
time: 0ms
memory: 3644kb

input:

5 10
798981764 -961045489
-762214604 -6816243
549909709 362471127
504233152 -881315415
503023672 -79630788

output:

374478686
488987952
802894107
1177372793
1289463099
1338052821
1572588671
1681411683
2140946928
2515425614

result:

ok 10 lines

Test #22:

score: 0
Accepted
time: 0ms
memory: 3540kb

input:

5 10
1000000000 935679491
1000000000 -1000000000
-672528121 86045658
-27175505 668128620
-1000000000 1000000000

output:

1227435578
1241426221
1294726376
1304695875
1935679491
2064320509
2522161954
2695304125
2758573779
4000000000

result:

ok 10 lines

Test #23:

score: 0
Accepted
time: 4832ms
memory: 11948kb

input:

250000 10
-948716000 849498000
-19336000 43260000
383914000 851118000
294484000 -499866000
992064000 -152080000
-722762000 664374000
-397052000 -119624000
215542000 -482304000
-32304000 -507668000
435166000 -506284000
611994000 -352720000
802744000 -932694000
592042000 532386000
-202942000 715584000...

output:

607
629
999
1000
1053
1606
6000
8000
10000
10000

result:

ok 10 lines

Test #24:

score: 0
Accepted
time: 819ms
memory: 11904kb

input:

250000 10
795063277 0
303615221 0
562810102 0
845741916 0
956345420 0
942584145 0
666706884 0
256192010 0
741156226 0
363435399 0
298151235 0
587472333 0
653215769 0
853934518 0
739535266 0
210551855 0
310605611 0
416947341 0
270706356 0
470688919 0
192093173 0
479394825 0
160606025 0
336338351 0
29...

output:

3377
3377
3377
3377
3377
3377
3377
3377
3377
3377

result:

ok 10 lines

Test #25:

score: 0
Accepted
time: 2508ms
memory: 11864kb

input:

249999 10
-560000220 -176000412
-46000477 -780000110
-938000031 -732000134
-514000243 -292000354
-652000174 -498000251
-612000194 -352000324
-852000074 -252000374
-506000247 -222000389
-824000088 -682000159
-294000353 -154000423
-914000043 -450000275
-642000179 -932000034
-164000418 -340000330
-7880...

output:

1
1
1
1
1
1
1
1
1
1999998

result:

ok 10 lines

Subtask #5:

score: 27
Accepted

Dependency #1:

100%
Accepted

Test #26:

score: 27
Accepted
time: 3023ms
memory: 8796kb

input:

100000 250000
-188504253 733867184
-245375735 -684199482
428330106 797621144
305301456 -571387745
-570806866 76376583
389555467 -943852569
-697651766 -28860673
-24114814 -344023598
122387926 297849647
-72704609 706066583
-952088382 583279358
658114605 -155510338
485645748 655756129
119604308 3636614...

output:

27977
30451
39984
51315
62511
64497
65183
68291
69145
73364
74134
74390
77828
77969
78896
81302
84783
85340
94818
96874
99293
100066
101611
102174
102879
108241
112391
112926
113608
114841
120989
121344
121640
121809
123443
126725
127659
134018
135127
136421
136433
140669
142097
142137
142245
143967...

result:

ok 250000 lines

Test #27:

score: 0
Accepted
time: 2984ms
memory: 8980kb

input:

100000 250000
387071275 989916673
506921967 325142581
-839571556 -937353875
452500446 993518980
204969652 -607923833
182747 332985458
-465211995 -874287693
-455794472 -330081664
15375046 -183516571
-129372351 -315516851
-366912854 -110015056
684341055 667511924
-273784431 758212875
-384787973 -59764...

output:

19101
25547
38066
41780
49170
59683
60333
61385
61459
62724
63901
64755
65278
67619
71194
72575
76028
77047
78229
78851
79505
83334
83612
84348
86140
87242
94989
99942
100638
101515
106042
106083
109917
110075
111214
113045
113122
117259
119389
119619
122813
122945
123477
127041
128859
129193
133052...

result:

ok 250000 lines

Test #28:

score: 0
Accepted
time: 154ms
memory: 5568kb

input:

707 249571
758954737 898931764
175456586 1000000000
55904278 -204862887
-1000000000 -573241845
548208972 475300777
-413365983 -135636343
-984030943 1000000000
-176735630 -284911562
-1000000000 -525008685
586673452 -988445495
-1000000000 -633842093
862717747 3941436
-333107263 -1000000000
-302435623 ...

output:

12256
131862
140201
172221
271658
278190
319131
335171
374588
413950
446158
448363
470184
523552
604799
619798
683269
862313
917486
937741
945819
1008119
1143065
1153453
1165966
1228886
1232959
1442509
1467852
1475602
1481587
1612212
1617529
1749587
1756511
1765014
1766038
1772406
1779277
1862254
18...

result:

ok 249571 lines

Test #29:

score: 0
Accepted
time: 2353ms
memory: 8796kb

input:

100000 250000
-749932510 35053087
-633944660 -106424583
-387949559 -897828480
-985236557 -606263449
102142660 124120753
336575652 698980377
-620888004 -167838545
-492100230 -407241135
158550348 -319163721
131932741 759266552
-458926788 -593738595
-399456654 495446915
12304798 -31128755
-440909703 -5...

output:

6
9
23
25
30
31
34
35
36
39
42
43
43
45
47
50
56
58
59
60
61
61
62
63
65
66
66
69
69
73
73
76
76
77
80
81
84
85
85
86
86
87
87
88
89
90
90
93
94
94
94
95
96
96
98
98
100
101
102
103
103
103
104
105
106
106
107
107
110
112
112
114
115
116
117
117
118
118
119
120
122
122
122
122
124
125
125
126
126
12...

result:

ok 250000 lines

Test #30:

score: 0
Accepted
time: 1728ms
memory: 9092kb

input:

100000 250000
990017028 -398937088
531411232 -781518804
163247876 -620397272
960554056 621824544
734710108 379931068
972613048 94607744
-840401056 -791728168
-49663240 -297134728
536348428 227358604
956374188 75980388
-105953100 491797152
804457104 836628980
61387260 108836772
-805476584 -435536420
...

output:

4
7
7
8
8
9
9
9
9
9
10
10
11
11
12
12
12
12
13
13
13
13
13
14
14
14
15
15
15
15
16
16
17
17
18
18
19
20
20
20
20
20
20
21
21
21
21
21
22
22
22
22
22
23
23
23
23
23
24
24
24
24
24
25
25
25
25
25
25
26
26
26
26
26
27
27
27
28
29
29
29
29
29
29
29
29
29
30
30
30
31
31
31
31
31
32
32
32
32
32
33
33
33
3...

result:

ok 250000 lines

Test #31:

score: 0
Accepted
time: 1687ms
memory: 8852kb

input:

100000 250000
53991044 861649585
186464546 79425097
438795026 521003437
-444361654 356988625
-198339436 -746957225
117073664 521003437
151769105 498924520
-113177899 202436206
-491673619 -176059514
605963969 -131901680
139152581 675555856
-378124903 -49894274
281088476 -324303671
12987341 -926742692...

output:

6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308262
6308...

result:

ok 250000 lines

Test #32:

score: 0
Accepted
time: 1608ms
memory: 8872kb

input:

99996 250000
-784615403 -692307719
-223076993 -415384668
-438461588 -184615456
-738461561 -315384676
-984615385 -530769271
-400000054 -353846211
-923076929 -900000007
-515384659 -953846157
-553846194 -130769308
-961538464 -576923113
-76923160 -784615404
-761538483 -561538501
-484615430 -553846194
-5...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 250000 lines

Subtask #6:

score: 35
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

100%
Accepted

Dependency #4:

100%
Accepted

Dependency #5:

100%
Accepted

Test #33:

score: 35
Accepted
time: 7300ms
memory: 13916kb

input:

250000 250000
891924283 -485903068
-793598291 -15887015
-892552532 -981111733
586580112 864682542
-538693122 -130138585
856927011 805536033
-780822598 824857872
-248112699 105047086
-800986125 304391703
-14805076 -772768093
-729246381 783568491
801156766 -417003227
-24958621 737109710
-748474855 385...

output:

8038
8783
12942
17250
21373
24440
25555
26188
28464
29938
30037
31353
32224
35483
36497
36879
38840
40307
40615
40857
44810
45679
45701
46282
47017
47089
47145
47567
48429
49355
51784
52724
54196
55230
55246
55451
56400
57275
58331
58765
58856
58904
58985
59348
59973
60722
60841
60984
62468
62693
63...

result:

ok 250000 lines

Test #34:

score: 0
Accepted
time: 7208ms
memory: 13880kb

input:

250000 250000
52862534 979569421
-35367979 479484628
-8103562 -63993950
114134697 469545488
90522329 -291309487
-199788404 465256693
772388802 707169532
-741429243 -907475422
-446379308 -419232712
-280012213 -5212653
280386704 70467240
-771917478 393682175
74131477 304303766
-131069782 -644587789
-5...

output:

10592
10775
12003
14014
15746
17175
18035
19476
20403
24506
24677
26514
27744
28367
28773
30183
30980
31098
32542
34073
34514
35233
36390
36560
36597
37920
39089
39656
39835
40015
40143
40371
40673
41563
41690
43952
44737
45321
45503
46051
46399
47024
47124
47302
47523
48225
48307
48369
49567
49569
...

result:

ok 250000 lines

Test #35:

score: 0
Accepted
time: 6626ms
memory: 13840kb

input:

250000 250000
318835408 948346476
921789012 499545752
972388200 -849160692
-773703076 194149500
569723960 136404152
621066932 -173389176
-853404636 767803848
-911390620 -195914164
265581932 -212707640
565042496 981510492
-518103892 703087348
458856392 -351000420
313745592 113186424
-649790120 227328...

output:

9
9
16
17
21
23
26
26
28
29
32
35
35
37
40
42
47
47
49
50
50
53
54
55
57
58
59
61
61
61
62
63
63
63
65
66
67
68
68
69
69
70
70
70
70
71
72
72
73
74
74
75
75
75
75
75
76
76
79
79
80
80
83
83
84
87
88
88
89
90
90
91
92
93
94
94
95
95
96
96
97
97
97
98
99
99
99
100
100
100
100
100
100
100
100
101
101
1...

result:

ok 250000 lines

Test #36:

score: 0
Accepted
time: 3346ms
memory: 13876kb

input:

250000 250000
-632738539 -724182557
-434168146 -798477602
-451278520 -786770504
-607973524 -974084072
-536830390 -840803264
-608423797 -862866641
-512515648 -695815358
-638592088 -919150766
-662456557 -710674367
-730898053 -648536693
-707934130 -875024012
-545835850 -678704984
-670111198 -831797804
...

output:

900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546
900546...

result:

ok 250000 lines

Test #37:

score: 0
Accepted
time: 3441ms
memory: 13864kb

input:

250000 250000
-368877237 -181501005
-5569773 470589315
-795841137 -114739377
-569162121 -55740729
-49042461 -172185429
-493084917 -159764661
110874927 -490467609
-795841137 102624063
-395271369 130570791
-174802737 -807197193
-399929157 442642587
-507058281 -347628777
-272616285 -106976397
-24622215...

output:

3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105192
3105...

result:

ok 250000 lines

Test #38:

score: 0
Accepted
time: 3196ms
memory: 13844kb

input:

249999 250000
-577854746 -605536401
-664359921 -512110812
-861591720 -671280335
-916955032 -688581369
-906574410 -456747501
-179930941 -280276943
-705882405 -671280334
-750865096 -93425766
-363321911 -460207708
-487889364 -224913631
-695501783 -463667915
-304498393 -501730192
-103806387 -854671306
-...

output:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
...

result:

ok 250000 lines

Extra Test:

score: 0
Extra Test Passed