QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#718767#9613. 计算几何Akagi_shigeru0 795ms312880kbC++141.1kb2024-11-06 21:23:322024-11-06 21:23:33

Judging History

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

  • [2024-11-06 21:23:33]
  • 评测
  • 测评结果:0
  • 用时:795ms
  • 内存:312880kb
  • [2024-11-06 21:23:32]
  • 提交

answer

#include<bits/stdc++.h>
#define ll long long
using namespace std;
const ll inf=1e18;
const ll maxn=1e6+10;
ll n,q,ans[maxn];
struct que{
	ll l,r,id;
};
struct point{
	ll x,y,id;
}p[maxn];
ll dis(point a,point b){
	return abs(a.x-b.x)+abs(a.y-b.y);
}
pair<ll,ll> cal(ll l,ll r){
	ll res1=0,res2=0,ans=inf;
	for(ll i=l;i<=r;i++){
		for(ll j=i+1;j<=i+20&&j<=r;j++){
			if(dis(p[i],p[j])<ans){
				ans=dis(p[i],p[j]);
				res1=i,res2=j;
			}
		}
	}
	return {res1,res2};
}
void solve(ll l,ll r,vector<que> v){
	if(v.empty()) return;
	pair<ll,ll> res=cal(l,r);
	vector<que> v1,v2;
	for(auto it:v){
		if(it.l<=res.first&&it.r>=res.second) ans[it.id]=dis(p[res.first],p[res.second]);
		else if(it.l>res.first) v2.push_back(it);
		else v1.push_back(it);
	}
	solve(l,res.second-1,v1),solve(res.first+1,r,v2);
}
int main(){
	// freopen("geo3.in","r",stdin);
	scanf("%lld%lld",&n,&q);
	for(ll i=1;i<=n;i++) scanf("%lld%lld",&p[i].x,&p[i].y);
	vector<que> v;
	for(ll i=1;i<=q;i++){
		ll l,r;
		scanf("%lld%lld",&l,&r);
		v.push_back({l,r,i});
	}
	solve(1,n,v);
	for(ll i=1;i<=q;i++) printf("%lld\n",ans[i]);
}

Details

Tip: Click on the bar to expand more detailed information

Pretests


Final Tests

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 6092kb

input:

2000 2000
983850330 731103020
513263912 234227610
788795134 228585831
-983909940 -814082030
-582261039 729875680
617950974 -259602422
-355311469 355769341
-394119311 -493842356
899026446 -402238603
-300533665 433674923
946553927 26786776
46270288 43713228
-838909861 427788951
863776211 691106038
-93...

output:

1660620
21077853
1660620
43762989
1660620
1660620
12536132
57819607
1660620
1660620
21077853
1660620
1660620
21077853
1660620
39985875
22418852
1660620
39985875
1660620
1660620
1660620
37877811
1660620
1660620
38281634
1660620
1660620
1660620
38281634
17253078
15002876
1660620
1660620
1660620
166062...

result:

wrong answer 1st numbers differ - expected: '511457', found: '1660620'

Test #2:

score: 0
Wrong Answer
time: 2ms
memory: 6044kb

input:

2000 2000
407439483 0
-924180082 0
534637753 0
-836707453 0
-385278990 0
90204634 0
454360393 0
-895242427 0
-112231538 0
-323497705 0
368203671 0
-124641980 0
183953551 0
596609116 0
666423112 0
706701157 0
988299741 0
-248457324 0
-507127215 0
610030981 0
356918300 0
110156240 0
317203493 0
754544...

output:

1043672
49350
56414
49350
56414
56414
49350
61048
49350
49350
182636
49350
49350
203446
1792807
49350
49350
49350
49350
203446
49350
49350
49350
49350
49350
49350
182636
49350
56414
49350
207612
203446
49350
49350
49350
49350
271691
49350
49350
49350
271691
237596
49350
56414
49350
49350
49350
49350...

result:

wrong answer 2nd numbers differ - expected: '417', found: '49350'

Test #3:

score: 0
Wrong Answer
time: 6ms
memory: 10092kb

input:

20000 20000
-721847248 671834627
-750033826 -893098471
358123311 740735694
-15749050 352553172
331628828 285387115
-870680297 30680547
747479743 495644671
-24785538 458380663
-49052185 540025540
192115219 694762799
-582891748 -643029079
-356894103 726491498
213744952 457769371
-357728988 745592631
-...

output:

6925797
3833184
8331490
4689419
4689419
4689419
4689419
4689419
4689419
3833184
4689419
4689419
6925797
3833184
4689419
4689419
4689419
3833184
4689419
4689419
3833184
4689419
4689419
5667365
4689419
4725645
4689419
4689419
3833184
6925797
3833184
4725645
4689419
4689419
4689419
4689419
10602817
472...

result:

wrong answer 1st numbers differ - expected: '384993', found: '6925797'

Test #4:

score: 0
Wrong Answer
time: 12ms
memory: 7860kb

input:

20000 20000
-856287 613193
884980 313749
-51917 -595036
-515889 732611
768011 201825
685038 -690361
-825296 610210
693313 378198
153998 -220528
-881367 -427847
-762386 726194
-882783 -396975
-585188 -646369
852468 -769564
845740 446417
-272832 806448
-23829 -843528
-290649 -509815
183302 929309
-810...

output:

1996
1996
2807
4434
2807
14174
4434
1996
8360
1996
1996
1996
4434
4434
2807
1996
1996
1996
1996
11689
2807
1996
1996
1996
1996
1996
9521
1996
2807
1996
4434
1996
2930
1996
1996
1996
2807
1996
4434
1996
1996
1996
1996
1996
1996
1996
7012
4434
2807
1996
2807
4434
1996
8360
1996
1996
1996
1996
4434
443...

result:

wrong answer 1st numbers differ - expected: '398', found: '1996'

Test #5:

score: 0
Wrong Answer
time: 12ms
memory: 7400kb

input:

20000 20000
272933 -400117
36074 -350576
-180416 245927
-152816 -532917
-815869 -121672
900928 561561
696604 -34106
281988 -30073
37999 -748187
-260504 367199
-254538 984542
-929979 -597816
735632 -731486
-88688 -820300
-180173 516379
319782 -306180
461815 88179
-863913 497662
-972928 920984
670858 ...

output:

3754
3444
3444
3444
3444
3754
3444
5482
3444
3444
3754
3444
3444
3444
5051
3444
3444
3754
3444
3444
3444
3552
3444
3444
7521
6009
3444
3444
3444
3444
7521
3444
6009
3444
3444
3444
8495
3444
3444
3444
3444
3444
3754
3444
3444
3754
3754
3444
3444
19932
8495
3754
3444
3754
3972
3444
3444
3754
3754
3444...

result:

wrong answer 1st numbers differ - expected: '663', found: '3754'

Test #6:

score: 0
Wrong Answer
time: 13ms
memory: 8624kb

input:

20000 20000
961714 0
-256591 0
858025 0
302536 0
989232 0
921482 0
132252 0
-687494 0
976712 0
584368 0
-379471 0
-368374 0
-421478 0
-269707 0
-840836 0
683604 0
-233785 0
-509259 0
691924 0
-326966 0
699666 0
-602646 0
-394566 0
-762188 0
-721221 0
110375 0
123249 0
-679471 0
476495 0
-247891 0
-6...

output:

13
13
7
13
3
3
13
3
3
7
7
7
7
7
43
7
11
7
11
13
13
11
25
13
3
13
13
7
7
3
7
93
7
7
7
7
7
7
7
3
7
7
13
11
7
7
24
7
7
7
7
102
13
11
13
36
7
847
3
3
7
7
13
7
13
11
13
7
3
7
3
7
7
3
83
7
109
13
3
7
7
7
7
7
13
7
7
13
7
7
7
11
7
7
11
7
7
13
69
7
166
605
79
7
7
7
3
7
7
7
7
11
13
7
225
3
13
13
56
29
14
7
3
...

result:

wrong answer 1st numbers differ - expected: '0', found: '13'

Test #7:

score: 0
Wrong Answer
time: 12ms
memory: 7148kb

input:

20000 20000
931651 0
-193344 0
-459921 0
-208681 0
265915 0
221047 0
-976889 0
836902 0
-128302 0
775194 0
523077 0
-398264 0
296667 0
-324286 0
477274 0
226741 0
-70369 0
627346 0
-81394 0
525865 0
454142 0
708462 0
-629738 0
-171617 0
-745312 0
-647420 0
-249238 0
-911374 0
255729 0
565402 0
-3974...

output:

10
1
6
1
1
1
1
1
1
1
1
1
1
1
1
1
6
1
1
1
1
1
6
1
11
1
1
6
10
1
1
1
6
1
1
11
227
1
10
1
1
10
1
10
101
1
1
1
1
1
1
10
208
1
1
1
1
1
1
1
1
6
6
1
1
1
1
1
1
4
1
6
1
1
1
1
52
1
1
1
10
10
1
1
1
84
1
1
1
8
1
1
1
1
1
8
1
1
1
1
1
10
1
1
101
6
1
8
1
6
52
8
1
1
1
6
1
1
1
1
6
1
719
1
1
1
1
1
1
1
1
6
1
27
1
1
1
1...

result:

wrong answer 1st numbers differ - expected: '1', found: '10'

Test #8:

score: 0
Wrong Answer
time: 8ms
memory: 8100kb

input:

20000 20000
286328653 0
-436132873 0
-950502327 0
62507734 0
410183824 0
-244422860 0
-89619254 0
-36224025 0
987264815 0
-366170043 0
789288990 0
595133547 0
129243363 0
480765515 0
-367270251 0
85317458 0
-717834130 0
990039646 0
601945059 0
979377776 0
487802144 0
-543661591 0
-649863532 0
530289...

output:

1065
1065
35564
18250
59793
1065
5108
1065
83617
1065
5640
5108
1065
5640
1065
5640
5108
5344
5640
1065
1065
5344
5108
53204
5344
1065
5344
5344
1065
5344
5344
5108
1065
5108
1065
1065
5108
5108
5108
1065
5108
21086
5108
5108
5344
11335
1065
1065
1065
1065
11335
1065
1065
5640
16260
5108
5108
18250
...

result:

wrong answer 1st numbers differ - expected: '1', found: '1065'

Test #9:

score: 0
Wrong Answer
time: 118ms
memory: 26052kb

input:

200000 200000
-412960500 577830338
99802584 -136950865
-950307156 -859369040
793568959 -565815756
411737945 -479377622
569675957 -601905445
-417176412 -729638186
200119881 -430545998
-86043427 969867029
64175162 -427861527
83451953 -756750354
-748032722 43908052
418515829 494502750
346664686 9215021...

output:

596156
596156
596156
596156
596156
746149
2594866
596156
1661072
596156
596156
596156
596156
596156
596156
596934
596934
596156
596156
596156
596156
596934
596934
596156
596934
596156
596156
596934
2983031
596156
596156
746149
596156
596156
746149
596156
596156
596156
596156
596156
596156
596156
596...

result:

wrong answer 1st numbers differ - expected: '9239', found: '596156'

Test #10:

score: 0
Wrong Answer
time: 115ms
memory: 40148kb

input:

200000 200000
215020 -29462
152216 -199822
-604632 -191567
10263 -830451
-89159 -121408
-881329 -921244
-809798 -903639
29060 -438373
-393896 -438778
79484 803288
646060 323407
-150152 23631
-509647 -88435
-772163 923612
-832132 -270978
650123 -731403
997559 -457855
797171 863407
366847 -915734
-700...

output:

1324
1863
1324
2600
1324
1863
1336
1324
1324
1324
1324
2051
1324
481
1324
1324
481
1863
1324
1853
1324
1324
1324
1324
1324
1324
1324
481
1324
1863
2923
1534
1324
481
2974
1324
1324
1324
1336
481
1324
2051
1324
1324
1534
1324
1324
1324
1324
1336
1324
481
1324
1863
1324
1324
1324
1324
1324
1324
1324
1...

result:

wrong answer 1st numbers differ - expected: '3', found: '1324'

Test #11:

score: 0
Wrong Answer
time: 134ms
memory: 41636kb

input:

200000 200000
-814016 -440530
-988229 -214220
-825745 -268031
808279 -507843
-365671 559807
-823503 84191
685041 -755331
-379355 -288337
-730097 156308
-49982 -920817
135131 710420
786978 14054
-877243 607279
-61488 -541803
839910 -778520
498514 -990675
408344 758599
-596998 201097
-711216 615872
60...

output:

882
1242
3535
1873
1873
1242
882
2115
3510
1873
2115
882
882
1242
3285
9483
1242
882
1242
5036
1873
882
882
882
2115
882
882
2115
1873
882
882
1242
6258
1873
882
882
2115
882
4396
1873
882
1873
2115
2115
1242
1873
882
882
1873
882
882
882
1242
882
2115
1242
1873
882
882
1873
2758
1242
882
882
1242
1...

result:

wrong answer 1st numbers differ - expected: '6', found: '882'

Test #12:

score: 0
Wrong Answer
time: 123ms
memory: 38840kb

input:

200000 200000
492262 0
767261 0
-49558 0
763447 0
-766015 0
305219 0
216950 0
309815 0
-563799 0
-576993 0
807708 0
-28765 0
805496 0
-792510 0
452313 0
636912 0
251743 0
367464 0
460580 0
731290 0
-899643 0
35424 0
900164 0
-627830 0
-200278 0
-364485 0
85580 0
348513 0
-445170 0
782325 0
867546 0
...

output:

0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
17
0
0
0
0
0
0
0
2
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
2
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
1
10
0
1
0
3
1
0
0
0
1
0
0
0
1
0
1
0
0
0
2
0
0
1
0
0
0
0
0
0
0
0
0
3
0
1
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
...

result:

wrong answer 13th numbers differ - expected: '0', found: '1'

Test #13:

score: 0
Wrong Answer
time: 118ms
memory: 33716kb

input:

200000 200000
547911 0
477311 0
650541 0
-105453 0
626756 0
-374148 0
-185598 0
-740854 0
845506 0
692548 0
-87545 0
-338111 0
-672163 0
348336 0
790086 0
588112 0
874537 0
-165894 0
602594 0
-951962 0
121709 0
597190 0
-231436 0
954727 0
874009 0
923477 0
176425 0
-953583 0
107836 0
-354119 0
80494...

output:

0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
4
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
13
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
1
0
3
0
0
0
0
0
0
0
0
0...

result:

wrong answer 4th numbers differ - expected: '0', found: '1'

Test #14:

score: 0
Wrong Answer
time: 112ms
memory: 30792kb

input:

200000 200000
-317746997 0
-151278487 0
231239102 0
-333682162 0
817071806 0
778079717 0
-29317929 0
-796844681 0
-969298078 0
-290624098 0
-687507332 0
967855359 0
-200682268 0
446953365 0
829160344 0
431722814 0
-321478842 0
500793767 0
-958916933 0
-993173724 0
-583938136 0
-621654506 0
540155031...

output:

80
41524
80
80
7497
80
656
80
80
339960
80
2474
80
80
80
5093
2474
80
80
509
80
509
80
80
80
2474
509
80
2474
656
80
80
80
656
80
509
80
2554
80
80
2474
656
4612
80
80
2474
80
80
80
2474
80
2474
509
3916
2474
2474
80
80
80
80
2474
80
80
509
2474
80
80
80
80
80
6946
80
509
509
80
80
4612
80
2474
4716...

result:

wrong answer 1st numbers differ - expected: '0', found: '80'

Test #15:

score: 0
Wrong Answer
time: 160ms
memory: 116988kb

input:

2000 1000000
600102029 78163345
623529642 -781629210
-194743627 856505922
132730843 -866898111
496967234 357290802
424803615 -817449125
326888043 973054140
682875209 743038131
659124372 893679753
-415512262 835204413
-753019068 -821982592
650486625 656222368
765610921 -158965479
-131326155 454415998...

output:

12738277
12738277
24639534
12738277
12738277
12738277
17568878
12738277
55536188
12738277
9585148
181013291
9585148
9585148
23886441
9585148
17798889
12738277
9585148
12738277
12738277
12738277
17798889
9585148
23337525
9585148
12738277
12738277
9585148
12738277
9585148
9585148
9585148
12738277
9585...

result:

wrong answer 1st numbers differ - expected: '3681425', found: '12738277'

Test #16:

score: 0
Wrong Answer
time: 159ms
memory: 134752kb

input:

2000 1000000
172304227 0
104292738 0
-257051223 0
-21999534 0
-574879748 0
-574439539 0
-947027598 0
765205348 0
195088335 0
406074782 0
75136395 0
227990070 0
900067610 0
675451839 0
804606264 0
556516588 0
-511265459 0
510580926 0
863647316 0
807267358 0
-778168632 0
127848817 0
255183075 0
-60073...

output:

99331
133510
99331
116236
191835
116236
99331
99331
99331
191835
191835
133510
191835
99331
99331
99331
133510
99331
191835
1624037
99331
133510
116236
99331
191835
99331
99331
485640
99331
99331
116236
191835
99331
116236
99331
99331
99331
485640
116236
99331
99331
99331
191752
191835
99331
116236
...

result:

wrong answer 1st numbers differ - expected: '169', found: '99331'

Test #17:

score: 0
Wrong Answer
time: 181ms
memory: 27916kb

input:

1000000 10
156999516 -24390575
-347759760 638897014
-102812461 325031686
668597244 262829264
678216489 165516603
621656879 -412885032
233438419 931865318
709921083 -313209071
389603839 76036576
-769757796 359645480
-100357260 928717563
709905946 839359128
233518030 -695740543
524417586 -804059937
-4...

output:

1075735
387883
387883
387883
387883
3656897
387883
387883
387883
387883

result:

wrong answer 1st numbers differ - expected: '6232', found: '1075735'

Test #18:

score: 0
Wrong Answer
time: 239ms
memory: 28600kb

input:

1000000 10
281115 207197
-791397 227390
-769663 849805
-689936 477469
-251524 174662
189816 721806
-579178 -339234
993809 -705268
-690664 35222
-298116 -663820
-321165 -327572
-609151 166540
799070 -156124
-305786 89239
53446 -399972
845917 137485
316083 266638
-720291 -915315
-706115 135108
-161326...

output:

4492
536
1112
536
536
536
1324
1450
536
536

result:

wrong answer 1st numbers differ - expected: '152', found: '4492'

Test #19:

score: 0
Wrong Answer
time: 217ms
memory: 28108kb

input:

1000000 10
370517413 0
607064501 0
198217472 0
143369676 0
627031881 0
-242777381 0
-122948696 0
334651705 0
754835147 0
-975826131 0
-3570204 0
136544599 0
519231560 0
-21309928 0
-647797468 0
728822996 0
-239842256 0
854368498 0
-555223024 0
-177243458 0
-606866771 0
867321201 0
983555681 0
753390...

output:

74
535
906
74
906
74
124
74
74
508

result:

wrong answer 1st numbers differ - expected: '0', found: '74'

Test #20:

score: 0
Wrong Answer
time: 636ms
memory: 110928kb

input:

1000000 1000000
-565158168 192228664
-60734026 -876227887
169956757 458933534
415705153 359751682
706646043 -267237804
-785235125 -286053701
-810363619 -883277015
-917766646 796218920
568429513 157525175
652148934 -563141041
101229780 387951397
138582181 234580165
989042915 303473055
848403115 67207...

output:

341857
790672
341857
790672
341857
735833
735833
588171
341857
341857
341857
2818706
341857
341857
341857
341857
341857
341857
341857
1144696
911769
341857
341857
341857
341857
911769
341857
1789254
341857
341857
341857
341857
341857
341857
341857
341857
341857
588171
341857
1178240
341857
341857
34...

result:

wrong answer 1st numbers differ - expected: '1446', found: '341857'

Test #21:

score: 0
Wrong Answer
time: 625ms
memory: 126196kb

input:

1000000 1000000
937028 -142721
470057 -596447
805603 -653737
422827 -146839
-134461 -284129
-740611 -822073
129788 -760939
189012 76048
-649576 825583
376935 955180
-675052 -614100
217445 -951905
463589 -489265
309830 -722532
510085 591599
-961137 67299
-817170 188112
338633 -558591
-571501 -205785
...

output:

2403
326
326
326
883
326
326
326
2846
326
952
326
391
391
326
1305
326
326
326
326
391
326
326
326
326
326
391
326
326
952
883
952
326
326
326
326
326
326
391
391
326
391
326
326
326
391
326
326
326
326
326
326
883
326
326
326
391
326
326
1328
326
326
326
391
326
391
326
770
770
326
1787
326
326
326...

result:

wrong answer 1st numbers differ - expected: '157', found: '2403'

Test #22:

score: 0
Wrong Answer
time: 634ms
memory: 149056kb

input:

1000000 1000000
556639 -726845
488045 -320786
907001 -483744
941440 533716
-722534 856343
-338618 616639
491388 733720
-416677 107094
108121 465292
-123127 350855
657412 326868
-943626 -335813
-502533 257525
56288 -494808
-248448 -317412
463444 -822305
686331 178764
-255923 18808
-520494 -446761
624...

output:

701
701
701
498
1049
498
701
701
498
498
1049
649
1049
701
498
498
701
498
498
701
1718
1501
498
498
498
498
649
498
498
3465
1501
1509
701
701
649
1049
498
649
498
1509
701
498
498
498
498
1049
498
1049
498
1138
1049
498
701
701
1138
498
1223
649
1509
498
526
701
498
649
498
1509
498
498
498
498
70...

result:

wrong answer 1st numbers differ - expected: '2', found: '701'

Test #23:

score: 0
Wrong Answer
time: 720ms
memory: 266880kb

input:

1000000 1000000
-542377 0
80556 0
-734137 0
-588964 0
255112 0
598605 0
-363464 0
-703421 0
157594 0
-98285 0
799038 0
897889 0
-518690 0
-303647 0
-503359 0
166055 0
-173378 0
568761 0
-839895 0
-125384 0
-113615 0
-926581 0
-597497 0
865459 0
271137 0
779200 0
-589752 0
695449 0
-633220 0
477974 0...

output:

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

result:

wrong answer 9th numbers differ - expected: '0', found: '1'

Test #24:

score: 0
Wrong Answer
time: 795ms
memory: 312880kb

input:

1000000 1000000
475716 0
733854 0
-670602 0
-495883 0
879413 0
-549166 0
395637 0
-922358 0
-95497 0
261093 0
-855001 0
-232761 0
839785 0
415412 0
456189 0
487755 0
951642 0
68750 0
-207887 0
108335 0
73919 0
-829879 0
-521857 0
-235996 0
-474559 0
50128 0
599195 0
-72168 0
454461 0
384522 0
-27507...

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
3
0
6
0
0
0
0
0
0
0
0
0
0
0
0
0
2
0
0
0
0
0
0
3
0
0
0
0
0
0
0
0
0
0
0
0
0
3
0
0
0
0
0
0
0
0
0
0
5
0
2
1
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
...

result:

wrong answer 41st numbers differ - expected: '0', found: '1'

Test #25:

score: 0
Wrong Answer
time: 601ms
memory: 127328kb

input:

1000000 1000000
-647194312 0
923266193 0
311967052 0
26202656 0
145325407 0
-363221031 0
322109698 0
400374410 0
-666477923 0
-803868087 0
-739610118 0
941620833 0
335162000 0
-343764277 0
-854360295 0
354763517 0
-559596318 0
-857042621 0
638986823 0
-794261929 0
137855671 0
317157550 0
942335473 0...

output:

205
8
8
52
8
8
52
8
8
52
8
8
8
8
52
52
8
52
52
8
106
8
8
8
52
8
52
8
205
52
52
8
8
8
8
8
8
8
8
8
8
8
8
106
8
8
651
8
8
106
8
8
8
8
8
8
8
131
8
8
8
157
52
519
8
8
8
8
1516
8
52
106
8
52
8
8
8
52
52
8
8
8
8
8
52
8
8
8
157
8
8
205
8
8
8
8
8
8
8
52
8
8
8
8
8
205
8
8
8
8
8
106
8
8
8
15
8
106
106
15
8
661...

result:

wrong answer 1st numbers differ - expected: '1', found: '205'