QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#410008#190. New HomeAbdelmagedNour#12 1739ms40488kbC++201.0kb2024-05-13 02:09:532024-05-13 02:09:53

Judging History

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

  • [2024-05-13 02:09:53]
  • 评测
  • 测评结果:12
  • 用时:1739ms
  • 内存:40488kb
  • [2024-05-13 02:09:53]
  • 提交

answer

#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
using namespace std;
typedef long long ll;
const int N=300005;
int ans[N];
map<int,vector<array<int,3>>>queries;
multiset<int>store[N];

int main()
{
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	cout.tie(0);
	int n,k,q;
	cin>>n>>k>>q;
	for(int i=1;i<=n;i++){
		int x,t,a,b;
		cin>>x>>t>>a>>b;
		queries[a].push_back({1,x,t});
		queries[b+1].push_back({0,x,t});
	}
	for(int i=1;i<=q;i++){
		int l,y;
		cin>>l>>y;
		queries[y].push_back({2,l,i});
	}
	for(int i=1;i<=k;i++)store[i].insert(1e9);
	for(int i=1;i<=k;i++)store[i].insert(-1e9);
	for(auto&[tim,vec]:queries){
		for(auto&[type,loc,idx]:vec){
			if(type==0)store[idx].erase(store[idx].find(loc));
			else if(type==1)store[idx].insert(loc);
			else{
				for(int i=1;i<=k;i++){
					auto it=store[i].lower_bound(loc);
					int d=min((*it)-loc,loc-*prev(it));
					ans[idx]=max(ans[idx],d);
				}
			}
		}
	}
	for(int i=1;i<=q;i++)cout<<(ans[i]>100000000?-1:ans[i])<<"\n";
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 5
Accepted

Test #1:

score: 5
Accepted
time: 0ms
memory: 18440kb

input:

4 2 4
3 1 1 10
9 2 2 4
7 2 5 7
4 1 8 10
5 3
5 6
5 9
1 10

output:

4
2
-1
-1

result:

ok 4 lines

Test #2:

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

input:

2 1 3
1 1 1 4
1 1 2 6
1 3
1 5
1 7

output:

0
0
-1

result:

ok 3 lines

Test #3:

score: 0
Accepted
time: 3ms
memory: 18416kb

input:

1 1 1
100000000 1 1 1
1 1

output:

99999999

result:

ok single line: '99999999'

Test #4:

score: 0
Accepted
time: 4ms
memory: 18108kb

input:

20 10 20
1 6 1 1
1 9 1 1
1 3 1 1
1 5 1 1
1 2 1 1
1 7 1 1
1 7 1 1
1 8 1 1
1 3 1 1
1 8 1 1
1 5 1 1
1 2 1 1
1 10 1 1
1 7 1 1
1 7 1 1
1 10 1 1
1 1 1 1
1 4 1 1
1 6 1 1
1 8 1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1
1 1

output:

0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0

result:

ok 20 lines

Test #5:

score: 0
Accepted
time: 3ms
memory: 17680kb

input:

20 10 1
45 4 53 54
75 8 56 60
65 3 87 100
56 7 93 97
36 3 64 91
63 4 93 94
71 2 45 97
67 5 57 65
34 6 7 52
96 9 43 95
83 5 63 92
24 3 55 99
7 10 38 52
59 10 59 100
43 5 5 21
38 9 72 82
72 2 1 64
22 7 50 81
74 5 88 89
84 1 25 29
41 48

output:

-1

result:

ok single line: '-1'

Test #6:

score: 0
Accepted
time: 3ms
memory: 18004kb

input:

1 10 20
58 4 59 59
36 88
80 47
56 65
74 45
99 4
17 2
13 46
92 38
82 2
42 47
40 40
30 9
13 41
14 77
61 33
20 73
89 3
89 100
83 100
28 59

output:

-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1

result:

ok 20 lines

Test #7:

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

input:

20 4 20
61418457 4 33932551 98975124
50805588 3 56616927 66076460
44262243 1 58029464 59272268
34981593 4 10760710 89302332
58741675 3 60670049 77700264
33623668 3 63722438 67824726
62526450 2 43078579 75611393
4274055 2 14095759 73162733
87374777 4 83277088 91743411
94571186 3 89842706 99458411
124...

output:

10979904
42075856
54788268
-1
-1
42932550
-1
24180475
27529716
-1
-1
24630956
16686222
-1
35018819
52156445
41144455
35084106
64627631
26558377

result:

ok 20 lines

Test #8:

score: 0
Accepted
time: 3ms
memory: 17772kb

input:

400 6 400
13 6 1 2
6 2 1 5
1 6 10 11
14 6 9 12
3 1 10 15
10 1 10 13
12 4 7 15
3 5 7 7
11 2 15 15
9 4 2 10
9 2 2 2
3 2 11 13
2 5 4 4
15 1 6 14
9 6 13 15
2 3 14 15
10 3 9 11
3 2 12 13
6 5 13 14
13 5 13 15
5 6 1 4
8 4 6 15
7 2 6 12
7 2 11 12
2 6 9 15
13 1 6 11
4 1 8 13
12 2 2 10
6 2 4 6
3 1 11 11
10 6 ...

output:

0
1
1
1
1
0
1
1
1
1
2
0
0
1
4
1
1
0
3
1
0
0
1
1
11
0
1
5
2
0
0
8
2
2
4
1
1
1
0
1
2
0
2
1
1
1
1
1
0
1
0
1
6
1
4
0
0
1
0
0
1
1
1
4
0
2
5
2
1
1
0
1
1
3
1
1
0
0
1
9
2
1
1
1
1
2
2
1
1
1
1
1
1
8
1
1
1
1
1
3
1
1
1
1
0
3
2
0
7
3
1
2
1
0
1
3
0
1
2
2
0
0
1
0
1
1
1
3
2
3
3
1
2
1
1
1
1
2
1
2
1
1
5
0
1
5
3
2
1
1...

result:

ok 400 lines

Test #9:

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

input:

400 10 400
43340857 4 45698748 89832178
54619105 4 12139243 31375025
37861883 8 47732866 65672593
28228848 2 34377649 37188437
24894809 5 21779229 60269842
5631877 9 56806239 99891497
58348534 9 55212163 99535913
96241892 8 13013131 71454036
96553400 5 68855786 90287612
49896594 7 75131914 88890304
...

output:

61438693
10092902
17042653
-1
14307562
44443029
-1
12918912
18058222
21930309
8237607
16854750
21730597
12859269
16464543
5185522
11308124
17123350
33463533
39018069
7610293
25072752
-1
25395408
38817024
-1
-1
20033481
43512384
25208569
17827332
23318396
16702567
10179947
30415219
15582621
10432423
...

result:

ok 400 lines

Test #10:

score: 0
Accepted
time: 4ms
memory: 18428kb

input:

400 400 400
50895816 112 11074810 50852590
91036952 324 226350 42542861
93200007 152 88561471 97853611
58986775 6 42946440 47476776
29191962 123 42448629 81705957
85607864 215 29065353 76256459
63414892 222 13827288 67943972
74982535 186 36761229 88857832
62363052 134 7564006 70661082
17925970 164 9...

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
...

result:

ok 400 lines

Test #11:

score: 0
Accepted
time: 5ms
memory: 18428kb

input:

400 133 400
3672823 119 18980672 88133847
67471612 108 41504712 97890476
40231264 19 37977684 52706386
96965371 77 21512104 86735367
29768987 114 25023034 84911918
59319041 24 8655797 88359567
81666143 66 7551736 73528006
68054496 103 13398677 59490218
84578976 36 34975186 62284778
32378800 45 23893...

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
87968835
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
-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 400 lines

Test #12:

score: 0
Accepted
time: 4ms
memory: 18532kb

input:

400 400 400
1581479 181 42400111 59732368
907309 87 5432725 51741834
25558404 52 27591603 55926047
73925801 89 12982129 72562916
93044109 8 22280490 87851712
4340628 199 21917419 59718121
29672983 78 47325176 83492730
37972962 29 7273544 67846186
33992886 275 8776836 87243343
19347144 392 15078284 7...

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
...

result:

ok 400 lines

Test #13:

score: 0
Accepted
time: 4ms
memory: 18164kb

input:

400 11 400
40710338 3 16766984 69515403
16397634 1 40616452 86952344
23986892 4 3711721 90215388
77091994 9 20674420 67833193
91288329 1 33738566 54779431
10971676 10 6962019 90743517
31716858 8 45519538 68166156
5219948 2 17257088 68841179
83743328 11 47480189 76282688
78162024 7 32457788 53262410
...

output:

4939905
23411162
7237354
7801322
18434376
3540541
5694122
5210393
4697783
10462459
29677624
48631432
5297965
4337578
4367168
20332085
5214702
5091001
3888050
-1
5363635
4067299
6861399
15591527
4964092
1992550
6176507
5922653
16627616
-1
4028480
3968144
5974366
5520655
11225360
7374306
9720663
15759...

result:

ok 400 lines

Test #14:

score: 0
Accepted
time: 3ms
memory: 18456kb

input:

400 20 400
10522853 16 3875473 15470596
10244202 4 8804037 17670418
18427843 8 2894806 13624813
9342852 8 14040683 15305924
18066564 13 4953771 17185081
3290462 9 10613188 16519838
4724465 11 6497896 17646746
11138017 1 1435979 8077032
13696787 12 18036390 19470914
3792181 4 16705463 18216042
320466...

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
...

result:

ok 400 lines

Test #15:

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

input:

400 3 400
7133454 1 5318840 16336998
14681771 3 14283494 19488133
3067337 2 15733173 18756469
19418351 2 195529 14731721
1990147 3 12317038 15097650
14347730 2 7126801 7455128
2501003 3 7366596 15539428
8853316 1 7516862 8151398
6938740 2 6852313 16787099
12511351 2 15104531 16729860
13626126 1 1382...

output:

3722216
1410158
2153626
823235
1917377
1202314
3296486
503311
-1
11340917
1082628
1614137
647038
711346
6169693
826067
1314916
8511450
2219292
-1
1148822
-1
1017529
1349749
1487025
5455581
2091924
1324126
1280399
1082465
1458499
1221119
452102
-1
3476390
1904784
839574
16318381
3437188
3442616
87847...

result:

ok 400 lines

Test #16:

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

input:

400 5 400
1338030 5 46136 1306367
516205 3 349494 674020
1457759 4 746415 1812760
41272 2 871535 1098966
1341950 5 1210712 1759003
1702670 2 432353 1906011
1675031 1 48529 1212647
100509 4 1542025 1626545
2622468 1 2140798 2675670
3910307 5 3717865 3981158
2007817 4 2984729 3555785
2944217 1 3461836...

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
...

result:

ok 400 lines

Test #17:

score: 0
Accepted
time: 3ms
memory: 18120kb

input:

390 3 390
1146372 1 1908187 2533863
2446740 3 3169712 3309037
2202363 1 2162162 3137371
3073428 2 966559 2635463
3060348 1 260960 486563
2506279 2 1985241 2640110
2937458 1 1277976 1812302
1350636 3 1269239 2234342
2068936 1 999429 1946001
1420761 3 3269927 3275363
2426388 3 387304 1265083
1849865 2...

output:

2559714
2933290
-1
-1
1843610
-1
517555
-1
-1
-1
-1
2611274
-1
-1
1632355
-1
350545
1770180
2338077
2874779
-1
-1
1435419
-1
1493771
-1
-1
1234422
-1
-1
-1
1246494
2143487
-1
-1
540459
1783699
-1
-1
1921725
2021526
-1
-1
1193702
-1
-1
-1
1723826
2426718
1140893
-1
-1
-1
-1
-1
-1
-1
-1
-1
-1
1208901
...

result:

ok 390 lines

Test #18:

score: 0
Accepted
time: 4ms
memory: 18944kb

input:

389 149 400
36593831 1 3784273 96375485
57440282 2 958534 98542960
38126928 3 36034 95331355
65995762 4 3373043 94808111
65030237 5 1683594 96169742
45136127 6 3653996 96503703
45252615 7 1775667 98338135
43231951 8 2000685 98734395
52397663 9 3095884 94520660
49714105 10 3766068 95790579
58169746 1...

output:

87969247
72859305
68429822
43479966
67681502
41461135
-1
38705911
50920201
62354342
42817692
81347574
67782120
44084429
76912490
73173037
71906180
96490576
76300295
65820149
-1
-1
-1
50185691
44389446
91162883
55968963
48090511
-1
80243422
60098514
51422725
49394331
-1
94587322
71133032
73417555
514...

result:

ok 400 lines

Test #19:

score: 0
Accepted
time: 4ms
memory: 18360kb

input:

396 214 400
42515756 1 3535916 96655328
62797037 2 2166531 94172150
54706374 3 1673019 96908826
37187317 4 5509987 94559482
62877046 5 1536575 97664313
62983296 6 4035537 97218191
43302636 7 5146517 98805937
57309706 8 3399216 96886919
63256572 9 4926648 96596943
49677708 10 506253 96364987
65777237...

output:

-1
80008513
78843150
59666539
80122533
72078494
61089492
80862696
83795645
86778746
50300138
51832223
65358649
47009165
72324985
64088034
29646137
74622987
48723688
77298052
71177138
58490373
55898526
45671241
46521430
49333721
-1
79827583
76486609
70589261
56983351
42774125
51664780
58099775
330527...

result:

ok 400 lines

Test #20:

score: 0
Accepted
time: 3ms
memory: 17872kb

input:

400 60 400
65168552 1 197837 97436716
66046539 2 2134081 95527091
66571017 3 3559448 96613004
36988788 4 11000 99200331
54756442 5 1145407 98377638
41324404 6 1232549 99338549
56248628 7 2532157 99842825
48283742 8 2957722 96050598
58805713 9 4393295 95746782
52221940 10 4775438 96699019
44736110 11...

output:

82828320
43610946
70072097
-1
90431812
48735588
62380873
79599694
87284897
65914706
76156761
42193550
45940557
48735086
51087414
44759492
74544813
65748555
76115200
86176138
48380986
65448967
70454534
83370670
76652150
83001737
60636180
53112950
73421570
-1
88220587
45851734
27404047
37404723
745171...

result:

ok 400 lines

Test #21:

score: 0
Accepted
time: 4ms
memory: 17916kb

input:

400 156 400
35659043 1 732284 85371572
45924193 2 300458 96861163
51798218 3 9738240 81279603
48639012 4 1226735 83780005
39462195 5 14259398 94145546
63563965 6 19262677 95272800
46744742 7 11186812 89239479
62764248 8 3205351 84912684
55399381 9 6805424 91170796
66428174 10 6837155 82124706
666132...

output:

-1
-1
-1
-1
-1
57718465
59597605
-1
-1
76712633
-1
-1
46733455
48857358
45033779
70384412
-1
-1
78637763
56085255
53736848
-1
61285488
87213847
-1
-1
-1
-1
88887623
-1
77018654
-1
-1
58252836
53483510
55432344
70749579
77251386
-1
42475480
66290720
65882863
-1
-1
89115582
54632870
59687352
60510765
...

result:

ok 400 lines

Test #22:

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

input:

400 220 400
60010265 1 3506055 86504662
39242364 2 10118684 92677226
36800333 3 18464122 80675074
60560739 4 1830235 87394751
45634626 5 12535177 87516185
62076225 6 10626428 89113240
52804395 7 16021761 91866831
44587319 8 17539258 89117504
60068701 9 2538902 91720974
53107572 10 1453968 94357950
6...

output:

84128943
62779261
57986920
77069794
43009750
61970847
83751085
-1
64955848
82621676
29200170
68851882
68321556
70287403
-1
47762527
69161896
66810866
67525148
87431041
52847819
-1
90762425
-1
-1
52270616
60661847
-1
-1
91311424
-1
-1
36170220
67541926
-1
-1
79831892
53791087
47511890
-1
86146563
-1
...

result:

ok 400 lines

Test #23:

score: 0
Accepted
time: 4ms
memory: 17904kb

input:

400 67 400
50971008 1 17498802 98237405
51407088 2 1905731 87800053
43859608 3 5502162 95995264
55434904 4 3145908 86648306
58312055 5 6565727 93428077
45747874 6 8589669 96851899
65445952 7 4189389 91652438
42468020 8 16472444 81012485
49756570 9 2283378 86505353
34481412 10 17989125 93634060
33630...

output:

-1
-1
54670007
37497132
-1
69710453
-1
80607403
58549262
45194314
-1
-1
61850222
73113778
54785450
73680577
54503594
-1
54573549
42942792
55412688
88339613
-1
81422086
71743088
-1
-1
-1
61524433
67319990
89627240
36842748
60608110
-1
-1
42265173
38907568
70004148
55145544
-1
77038352
-1
75937776
-1
...

result:

ok 400 lines

Test #24:

score: 0
Accepted
time: 4ms
memory: 18348kb

input:

400 400 400
100000000 1 1 100000000
100000000 2 1 100000000
100000000 3 1 100000000
100000000 4 1 100000000
100000000 5 1 100000000
100000000 6 1 100000000
100000000 7 1 100000000
100000000 8 1 100000000
100000000 9 1 100000000
100000000 10 1 100000000
100000000 11 1 100000000
100000000 12 1 1000000...

output:

99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
999...

result:

ok 400 lines

Test #25:

score: 0
Accepted
time: 2ms
memory: 17932kb

input:

400 400 400
42800778 1 16708238 94002944
13609386 2 28182812 71544065
79832947 3 30921885 98635264
62399729 4 12564983 89835010
51775003 5 30035874 87064508
2061087 6 24395270 73376487
71261001 7 7503556 86723656
54959030 8 22211415 75859069
77785946 9 27158490 95058905
61567484 10 1293538 86938365
...

output:

-1
50800067
-1
-1
-1
49992900
-1
55521560
-1
-1
-1
-1
-1
-1
53256954
51497729
-1
-1
71307016
-1
-1
91689048
-1
-1
-1
-1
-1
-1
-1
-1
-1
95378179
72396658
-1
-1
-1
89726365
97884397
51137862
-1
86659312
-1
54934487
-1
-1
-1
54862867
63528429
-1
-1
-1
92417904
-1
59133946
-1
-1
-1
-1
-1
-1
67952954
-1
...

result:

ok 400 lines

Test #26:

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

input:

400 211 400
16349623 1 18670501 45718763
65134081 1 21253982 74076632
36007630 1 44580513 99460414
99368186 2 30068977 85427051
97159871 3 19511448 71140413
26069032 3 40490078 78656208
32840687 4 12485377 46718190
7825021 4 32727325 69341753
5683892 4 49429559 89043612
35280489 5 23054737 87387167
...

output:

63995317
70179831
54893043
-1
-1
-1
-1
-1
-1
-1
91360138
-1
-1
-1
78233321
-1
-1
-1
93895222
75137218
98817906
80975346
-1
-1
-1
88628991
-1
-1
-1
-1
-1
69610578
-1
-1
65743782
-1
62091674
-1
-1
-1
-1
-1
-1
-1
-1
-1
67938036
55935311
-1
88620728
-1
-1
-1
53173231
-1
51796073
86616415
78998362
-1
930...

result:

ok 400 lines

Test #27:

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

input:

400 134 400
84865763 1 1449762 51584911
95796263 1 33716370 66107739
75453703 1 42227669 85769765
20302341 2 6385782 55297433
5887904 2 21079050 79254029
75528010 2 53378619 80263375
13826063 3 2203433 34697852
91527815 3 26713672 54172170
54822186 3 47029672 78178094
94634415 3 56643018 93356838
87...

output:

73400983
-1
53020098
80363670
81130310
-1
-1
-1
73948425
79762681
51068556
-1
63703232
-1
-1
69966535
-1
60661669
63208336
-1
-1
-1
-1
-1
88833246
46100824
-1
-1
69765650
-1
89346236
79533532
79286511
-1
-1
-1
-1
-1
67614297
52315397
-1
93708987
73082447
83038217
-1
77811918
76049359
93229491
-1
-1
...

result:

ok 400 lines

Test #28:

score: 0
Accepted
time: 3ms
memory: 18936kb

input:

400 44 400
35710445 1 9007721 30409287
99830025 1 18556117 42738837
27742044 1 24711880 49116041
75561747 1 40255585 66442597
38838136 1 51202628 73522366
43391128 1 58006128 83308395
54391589 1 74052639 93292689
18813555 2 7143709 22979706
38137780 2 15294310 26845368
31578867 2 17340002 34862693
8...

output:

-1
-1
-1
69358418
47508193
57462448
91436740
43306499
-1
58625695
69002605
60169831
52469693
74406598
78419481
-1
-1
89661286
-1
-1
67126575
52018273
47955248
65619074
66787585
-1
49354404
90338810
82102061
48795239
72318628
58234587
73118905
85380974
57447730
53014458
-1
75817261
93998358
-1
-1
-1
...

result:

ok 400 lines

Test #29:

score: 0
Accepted
time: 3ms
memory: 17896kb

input:

400 4 400
99338201 1 166307 1517779
33122497 1 941823 2234415
26591611 1 1851389 3123709
85880965 1 2483664 3834948
21130586 1 3291700 4723269
38606139 1 3884897 5829967
1880626 1 5062762 6562574
48911187 1 5458475 6981242
70766404 1 6560529 8025738
34173440 1 6984644 8712958
39037143 1 7657953 8894...

output:

45871272
36412472
76488815
67691147
80486729
35337879
85347318
28505473
27830333
36916030
51357789
37228399
87185308
30412352
94227024
18308975
71974833
33661668
38413926
20519250
72901195
73330394
16371875
29164248
45174240
81776756
32548494
46086755
36162532
27021299
32636476
43387713
26079036
234...

result:

ok 400 lines

Test #30:

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

input:

400 38 400
25 1 1 9
44 1 5 11
11 1 7 15
19 1 11 18
21 1 13 20
36 1 16 24
2 1 20 25
23 1 23 29
19 1 25 33
32 1 29 34
27 1 32 39
32 1 34 40
40 1 37 44
44 1 41 48
49 2 2 6
18 2 3 8
29 2 5 9
43 2 8 12
47 2 9 14
22 2 12 16
43 2 14 17
26 2 16 19
48 2 18 21
35 2 20 23
10 2 21 25
35 2 23 28
49 2 25 30
14 2 ...

output:

21
-1
35
-1
23
33
-1
-1
-1
-1
38
31
45
-1
38
34
39
38
33
41
42
-1
-1
-1
44
33
35
-1
24
34
44
23
31
30
-1
-1
38
45
30
-1
-1
48
-1
34
-1
43
40
36
23
39
-1
-1
43
-1
-1
-1
-1
-1
34
-1
-1
31
45
-1
30
41
43
-1
39
-1
-1
-1
-1
19
26
-1
33
36
22
37
-1
-1
-1
30
-1
41
-1
23
40
-1
30
-1
-1
47
41
39
-1
21
24
22
...

result:

ok 400 lines

Test #31:

score: 0
Accepted
time: 3ms
memory: 18448kb

input:

384 10 400
5035229 1 991655 5533662
3603482 1 2507601 7562718
5564194 2 764732 3227992
2466016 2 2495702 4550403
6766088 2 3142475 5911283
2726868 2 4510137 7355752
9404587 2 5109287 8165169
2169510 2 7000147 9851527
3629740 3 398130 3003575
6971019 3 2216012 3940047
628399 3 3532328 6065713
2944502...

output:

6065596
4511772
4004006
4007738
-1
4579455
6123769
-1
-1
-1
8864479
6635331
9234073
8728976
4349712
-1
8551795
5250940
8317155
-1
5070960
6239584
5712384
7831379
5747330
6977275
7371654
-1
5955290
6550596
-1
3910169
-1
-1
-1
4515762
-1
8211029
5174090
7301418
7836710
6516404
-1
-1
-1
7244133
-1
-1
2...

result:

ok 400 lines

Test #32:

score: 0
Accepted
time: 3ms
memory: 18320kb

input:

386 5 400
3010571 1 265473 1846840
2931577 1 1009009 2278090
4163727 1 1660173 2587461
2092776 1 2015508 3242745
279381 1 3058966 4314701
4905437 1 3572796 4734963
4329741 2 854858 2943240
73617 2 1885920 3917828
1622531 2 2976368 4562943
4125968 3 440520 2111757
1631785 3 1352001 2688897
3406030 3 ...

output:

3568000
3571983
-1
3233575
2869780
-1
-1
2585663
2857727
-1
-1
3295297
2968050
3907981
-1
3748559
2835948
-1
2891425
-1
3070756
-1
1834919
-1
-1
2300471
1661432
1456564
3670895
1153404
-1
-1
-1
1773890
-1
-1
-1
3618682
2877529
2668980
-1
-1
-1
536976
2237487
-1
4335810
-1
1572944
3014847
1728098
271...

result:

ok 400 lines

Test #33:

score: 0
Accepted
time: 4ms
memory: 18684kb

input:

316 2 400
825956 1 100175 903953
426154 1 462872 1088377
897101 2 84589 1210058
1487006 1 1372976 1883084
2385585 1 1662844 2102052
1714347 1 1755052 2442517
1453071 2 1418917 2388314
2672491 1 2743402 3245198
3705056 1 2916952 3350163
2988636 1 3127404 3532645
3396694 2 2784626 3321007
3573433 2 28...

output:

408731
-1
567142
-1
-1
502240
-1
686438
874926
-1
813343
441601
798727
827209
-1
244251
558194
388456
306390
-1
-1
-1
628285
514421
661655
140600
685138
-1
251463
339872
316658
760875
224380
128970
-1
302566
317573
216406
256466
335239
299944
510629
-1
-1
1091691
571134
-1
590537
201583
152020
58079...

result:

ok 400 lines

Subtask #2:

score: 7
Accepted

Test #34:

score: 7
Accepted
time: 1739ms
memory: 40464kb

input:

60000 400 60000
36444793 284 3080519 96564525
76562130 166 22994125 59743695
76399902 168 29694545 59255380
66355790 132 10949454 89347938
40903435 35 29985718 66394219
83300910 368 17240174 54080010
85941830 363 31462093 87304647
73742613 40 29005856 54988711
27852051 29 6132393 88092297
52011498 2...

output:

4187955
12063529
12900463
3226307
10559309
3630811
3464102
2349487
10593270
4352751
12206074
3330919
9918520
2273900
2815160
3343146
4784218
4029015
3675912
3097583
3111953
3134642
2032575
7047105
2656134
3152545
4173492
4454062
10276964
8571917
2565070
2916843
3188475
2240657
2534321
4044412
133767...

result:

ok 60000 lines

Test #35:

score: 0
Accepted
time: 45ms
memory: 21952kb

input:

60000 6 60000
12 3 7 15
10 1 6 8
2 1 12 12
3 6 10 13
13 4 10 12
7 4 11 15
2 2 11 12
11 2 1 1
2 4 15 15
12 2 7 13
7 4 1 10
10 3 4 8
9 6 12 13
12 6 6 15
9 1 13 13
1 5 7 15
7 2 6 8
8 3 15 15
8 6 9 12
11 6 10 12
6 4 2 12
6 3 8 11
6 1 9 10
1 3 8 12
6 1 9 9
1 4 13 14
6 2 13 13
15 3 9 9
8 4 8 15
10 2 12 13...

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
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
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
...

result:

ok 60000 lines

Test #36:

score: 0
Accepted
time: 162ms
memory: 38800kb

input:

60000 10 60000
97676569 2 76743953 88685974
95105143 4 43932988 73376067
76288333 6 92617916 98270964
90342208 3 40402911 69639648
33843177 10 26986536 90194147
6267732 5 63608012 88523254
7434115 6 32023864 61989797
11761897 6 21980809 94495856
66188528 1 73264146 82110042
59171955 3 14277338 57524...

output:

50934
77902
89165
70557
268052
116409
122462
34028
87774
446481
473777
43573
80880
71259
189355
220880
97525
233847
48942
76322
115779
86109
56783
97528
179902
64312
209077
130350
64127
304725
133009
34783
37976
73757
147651
110108
795553
38989
182712
57437
50691
37940
48662
526097
42900
75153
11829...

result:

ok 60000 lines

Test #37:

score: 0
Accepted
time: 1254ms
memory: 38780kb

input:

60000 400 60000
35357917 106 38293412 94684300
83145885 104 8061264 45893965
34223214 63 89162022 92650692
17695158 303 7424324 16020399
80070382 360 36955678 84009798
92884003 244 82495997 98341121
35439223 250 58780027 74572027
65965217 348 62649096 64088389
81335145 154 16142185 56577974
61230381...

output:

4170388
10792534
4724031
9387143
-1
6113543
8419841
23129757
6935973
29089230
7150447
5429311
8848619
14220725
20216868
23459463
5977906
15120565
41700105
6291030
4346034
5828001
45713909
6915393
6394853
21183057
11929675
5675125
11188911
14125526
5203543
8659023
6877604
6884320
6842338
7762496
1908...

result:

ok 60000 lines

Test #38:

score: 0
Accepted
time: 836ms
memory: 40488kb

input:

60000 133 60000
20561991 86 25005935 61459650
26163084 90 46712018 76015341
35834416 95 29938241 83277292
91275144 36 3356508 79165872
45288993 129 33990712 50967656
23921464 4 2998749 83297148
90941504 98 41664456 94454241
35313504 42 21268586 90068636
33306098 121 27129638 83989086
59369734 133 24...

output:

4597679
1257253
1314315
1373379
746395
537598
1613056
1637922
1780770
2843637
1991792
2064448
724258
1046206
1003720
2065020
591046
728719
1765032
1529035
13009813
1213686
1242642
931843
1378061
1157507
616607
1812210
1742210
2435659
638669
1548908
1256669
746799
1916543
8344670
686201
2404961
14118...

result:

ok 60000 lines

Test #39:

score: 0
Accepted
time: 202ms
memory: 40404kb

input:

60000 11 60000
95017156 10 22055983 90540383
7214864 7 14505589 66729981
65618447 6 48075996 53916145
123143 10 4760078 75371216
63341349 7 44971994 83435307
65310969 7 28239153 64911494
38123767 11 3377065 60114696
58277623 8 32084862 53967693
96681909 7 33233164 99855578
19666257 9 5627734 6290910...

output:

336705
104860
94205
82790
43288
40651
54832
28163
26506
30596
18983
3739744
20887
31829
24015
41604
153894
41350
81612
57862
15729
86895
1025322
85802
221405
64158
87330
25630
29428
154778
77426
51096
24605
36197
50346
31159
33378
281265
53463
46743
39470
72112
21370
114028
51358
44094
24340
416178
...

result:

ok 60000 lines

Test #40:

score: 0
Accepted
time: 146ms
memory: 37876kb

input:

60000 20 60000
3425512 19 16018000 16549195
10119402 11 8238845 16194063
10268408 11 15839413 17100868
4399617 5 3259484 4732648
199676 11 16086296 18995937
1727842 8 7277268 16676508
6474927 13 3162304 7105628
5016549 5 5938383 19855399
5926152 13 4855095 17355188
3087266 8 918517 7822928
16432449 ...

output:

253004
164343
232146
348438
360215
141068
145249
260283
149276
224327
147694
259280
162914
254661
1130872
136138
2375633
153368
185090
175856
1274299
113654
143624
295611
244227
806555
200464
155743
162868
290566
166144
71081
221297
8732626
139680
140421
659251
484516
74592
1250711
143657
173489
143...

result:

ok 60000 lines

Test #41:

score: 0
Accepted
time: 98ms
memory: 38404kb

input:

60000 3 60000
18673433 3 5585202 14635377
783826 3 11774363 16770680
19553752 3 10057954 17405901
4686021 1 4633378 18808990
18193494 2 15475163 18023941
15045870 3 12037490 19440676
11189780 3 1998254 15563641
3689200 3 699453 762315
7205586 3 17614893 19586647
16220843 1 18388083 19723996
1728659 ...

output:

3099
6500
24888
159696
60871
7776
174516
17016
8163
99508
4769
17386
24043
11185
9724
707674
29885
13169
6701
9941
13405
7064
7448
26080
11853
58158
11457
48607
16725
10039
36762
11451
4153
168849
27848
11330
5740
42907
7483
28817
6565
3626
5997
15279
21600
32873
187015
9779
6529
9374
67572
13026
26...

result:

ok 60000 lines

Test #42:

score: 0
Accepted
time: 86ms
memory: 38432kb

input:

60000 5 60000
688239 1 1054551 1343759
180973 3 497075 543586
337167 3 853273 1769056
60342 3 262629 1916130
1563480 4 1419078 1530443
84479 1 1303616 1532279
514760 3 1511339 1772340
1583589 2 1633329 1783278
661787 5 736596 838091
1897157 2 1257190 1706268
1811663 1 100494 1797523
1622587 3 597834...

output:

12775
30199
38298
11590
55744
46051
47873
205893
90941
11330
8429
155284
84714
22339
18291
22005
36006
107643
110640
6161
25783
8564
31237
43086
27217
11362
16355
19282
16106
22465
40238
15981
17089
178549
36923
36752
53890
29567
21658
69362
48443
42018
22113
15784
78102
80409
61986
29617
8337
50702...

result:

ok 60000 lines

Test #43:

score: 0
Accepted
time: 90ms
memory: 37632kb

input:

60000 3 60000
2425933 1 1811168 2386010
1213569 1 1889604 2840745
1478278 1 874669 1590117
2807897 1 877927 2372459
1930604 3 662123 2545391
876201 3 317724 826102
1449373 2 1675828 2380928
562301 2 1338095 2549254
1023244 2 1785507 2886222
1848152 1 1753661 1999058
395709 2 1003035 3199243
1119344 ...

output:

6038
16852
6587
14319
4389
23142
110231
47901
26822
8757
169894
12226
22788
8932
21262
22982
46761
43432
7783
36162
28620
40483
17611
15331
98527
29128
18100
13254
51380
5983
32995
31639
3990
9003
27542
37097
17525
41749
8985
14129
5500
3854
79098
31518
10564
14931
11144
13924
50621
18356
20261
6961...

result:

ok 60000 lines

Test #44:

score: 0
Accepted
time: 261ms
memory: 38396kb

input:

59781 246 60000
37315959 1 60993 99801213
76422704 2 88569 948439
14046020 2 543599 1279657
8374607 2 1004457 1945741
40067097 2 1338158 2303255
21899560 2 1746120 2825984
31273845 2 2132469 2850232
26597475 2 2503612 3492829
43356396 2 2943290 3988444
11289373 2 3344028 4106971
45437891 2 3774846 4...

output:

74578823
76622648
73013434
90108506
51063886
73484565
48933151
72717340
-1
68961157
79954801
59001008
90732554
59750192
79321767
71427344
80948126
61836047
89246282
51759106
74064984
70128274
74145048
69402100
94406801
72222897
72756632
77956608
85049892
77741101
72834534
74127885
90290101
83721623
...

result:

ok 60000 lines

Test #45:

score: 0
Accepted
time: 352ms
memory: 38540kb

input:

60000 347 60000
66470962 1 12826942 88787444
86900368 2 26159482 73535463
71831560 3 6947936 58675484
78456057 3 32109463 90799791
99998804 4 15159826 59583172
37152313 4 31304630 68812769
5921233 4 40345601 93379104
12728410 5 4699578 44749006
69362307 5 32236449 64778266
97857017 5 35540293 809808...

output:

-1
64729533
-1
91994238
-1
65471365
69300455
79080511
93176276
-1
73186318
-1
-1
-1
-1
95110018
87449029
-1
-1
-1
-1
-1
-1
87751972
-1
91552158
71282793
-1
95490060
86455367
72476616
-1
-1
-1
49358706
63150818
-1
59953591
53296970
62747579
-1
-1
87304894
74845329
-1
-1
-1
-1
67781505
-1
-1
85598754
...

result:

ok 60000 lines

Test #46:

score: 0
Accepted
time: 191ms
memory: 23048kb

input:

60000 400 60000
100000000 1 1 100000000
100000000 2 1 100000000
100000000 3 1 100000000
100000000 4 1 100000000
100000000 5 1 100000000
100000000 6 1 100000000
100000000 7 1 100000000
100000000 8 1 100000000
100000000 9 1 100000000
100000000 10 1 100000000
100000000 11 1 100000000
100000000 12 1 100...

output:

99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
99999999
999...

result:

ok 60000 lines

Test #47:

score: 0
Accepted
time: 220ms
memory: 38532kb

input:

60000 198 60000
9095432 1 243193 771137
80236303 1 520439 874178
52146000 1 783121 1218256
35112073 1 949649 1545731
82268717 1 1149632 1668684
94054028 1 1520430 1939451
81189681 1 1885284 2286648
38906762 1 2151861 2696551
67991246 1 2455831 2981421
5951258 1 2544989 3313394
40346333 1 2957553 350...

output:

63321871
50195826
63147933
97291569
48592665
68629670
66739076
62707302
55018992
56455530
63519133
69857648
50938615
57769659
67061065
76767092
50053030
94433064
-1
52324182
66082894
60515406
-1
62168993
90238451
76826044
94434260
49303319
70985440
70265477
66336267
79427614
62986133
60065241
592082...

result:

ok 60000 lines

Test #48:

score: 0
Accepted
time: 135ms
memory: 37600kb

input:

60000 60 60000
98321395 1 8927 214763
68612679 1 123603 354938
35190718 1 210529 417336
61078644 1 329607 536731
53207463 1 373484 599622
48877415 1 537000 687679
31041929 1 614795 823539
49692897 1 734670 913854
59218351 1 754962 933816
65359961 1 893012 1075686
87351898 1 935909 1125846
48806010 1...

output:

45705196
52195993
95575646
53143537
78885385
45399284
80017113
54140330
87569701
39897014
75127428
74984434
79967311
68464764
48954190
69104414
60255318
76963073
83862626
80543415
73451548
89921740
51899795
95716878
55554915
76799026
75176115
66076680
57679193
76102903
77824168
79060140
71112800
692...

result:

ok 60000 lines

Test #49:

score: 0
Accepted
time: 85ms
memory: 37664kb

input:

60000 7 60000
40841429 1 1012 24513
68294018 1 11502 34849
81622562 1 33076 46768
22649411 1 33743 64990
37642709 1 53197 75824
12118727 1 56118 85129
38708722 1 70155 100781
27594550 1 81745 111481
62690 1 97653 122234
24384345 1 105288 129466
1328113 1 114498 142953
10830110 1 132461 152267
314372...

output:

66869082
61724092
65491542
44706122
35990332
77575183
52585229
32426183
48786578
30655237
62526724
52139867
46136859
41361333
29622578
58939948
28765458
53336522
74371698
85494901
28234193
69848438
30928704
37790814
22809402
56440597
27088725
42806668
74285070
38343485
18856777
15620780
40346452
407...

result:

ok 60000 lines

Test #50:

score: 0
Accepted
time: 62ms
memory: 37800kb

input:

57343 10 60000
18818 1 6425 26332
94952 1 14701 39520
4737 1 23921 54364
55499 1 42222 59730
16452 1 47605 74897
15088 1 57708 85132
96250 1 74157 96442
46432 2 774 28649
50622 2 18597 30787
42239 2 23538 49282
30883 2 35977 51551
89244 2 42001 67859
76185 2 55577 79336
5414 2 63617 87452
48371 2 79...

output:

39965
63837
55886
66807
39596
63967
79010
-1
48179
47580
-1
43070
-1
32096
-1
41924
52198
31438
-1
30946
-1
-1
-1
36227
54041
53833
-1
56476
59800
67516
-1
-1
67449
-1
80230
-1
-1
-1
58401
44913
48300
-1
39813
-1
-1
49904
-1
32342
80990
93929
49115
-1
-1
48891
74039
60027
57794
52127
-1
74178
-1
-1
...

result:

ok 60000 lines

Test #51:

score: 0
Accepted
time: 59ms
memory: 36896kb

input:

56600 5 60000
65920 1 5980 18734
5761 1 7167 22737
55716 1 16279 25828
2919 1 21166 35716
46655 1 29979 41388
98441 1 36931 44263
43391 1 42223 55259
92877 1 44038 59423
83779 1 54848 64556
18508 1 56992 72667
52190 1 68248 76115
85779 1 73934 86788
50232 1 78351 92741
40549 1 85228 97793
52115 2 44...

output:

27283
59033
-1
-1
31997
26260
37170
49830
36974
63752
27771
35169
50860
37462
56254
38832
19761
50142
34944
43468
-1
39958
44914
63654
-1
14281
84546
57939
68663
-1
37038
39397
-1
33155
-1
70049
25879
45707
52142
83501
49303
57787
64583
12836
20946
30246
36347
58667
78187
79150
36651
50623
30268
208...

result:

ok 60000 lines

Test #52:

score: 0
Accepted
time: 84ms
memory: 37192kb

input:

58144 20 60000
688620 1 21557 49553
947126 1 34398 73528
653491 1 57311 91664
841951 1 74082 134953
115951 1 96961 144546
759921 1 124937 178368
908401 1 143934 197373
396191 1 175446 218185
488430 1 197390 244525
634238 1 211085 270897
162428 1 229098 283496
182601 1 260626 296706
303257 1 294617 3...

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
...

result:

ok 60000 lines

Test #53:

score: 0
Accepted
time: 190ms
memory: 37568kb

input:

59464 200 60000
2352378 1 108912 535536
2878912 1 291617 657900
2005814 1 418310 833378
2638419 1 612534 1048686
1916673 1 839703 1194535
1024871 1 1102969 1416313
1802959 1 1244102 1704391
487562 1 1496813 1872417
2523590 1 1729293 2072949
2532229 1 1777304 2299568
1468307 1 2012813 2475395
1535590...

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
...

result:

ok 60000 lines

Test #54:

score: 0
Accepted
time: 75ms
memory: 37168kb

input:

57706 10 60000
493336 1 19737 85323
328969 1 53060 115770
2011146 1 82661 130140
42028 1 102428 160444
2270581 1 131762 206271
898573 1 163482 208451
3148819 1 195115 247064
2787613 1 212612 290923
705223 1 246364 298546
1156550 1 275641 350520
1469854 1 303755 358967
222303 1 326827 402431
2503196 ...

output:

2933594
1451023
1431485
2343312
1312240
791238
2013472
1466295
1012478
2487842
1368806
1768772
2938981
1390999
2426851
2014093
2006880
800391
2382933
1785060
1030365
1363946
952305
1976991
1209162
1584907
2522414
1438505
1522775
2011021
2372154
1238304
2016718
1398714
1781171
-1
1358780
777118
20115...

result:

ok 60000 lines

Subtask #3:

score: 0
Time Limit Exceeded

Test #55:

score: 0
Time Limit Exceeded

input:

300000 60000 300000
52373645 39403 1 100000000
43175904 13875 1 100000000
55098270 40348 1 100000000
69248668 7569 1 100000000
69220659 14654 1 100000000
92585410 38487 1 100000000
41202983 28786 1 100000000
47874378 18728 1 100000000
7254419 14009 1 100000000
94592111 3845 1 100000000
19140558 2773...

output:


result:


Subtask #4:

score: 0
Skipped

Dependency #3:

0%

Subtask #5:

score: 0
Time Limit Exceeded

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #84:

score: 0
Time Limit Exceeded

input:

60000 60000 60000
83448872 10404 45205919 50339735
36708841 21497 4902082 97712964
34097261 45398 38638183 51297139
10793824 31369 13841638 75803309
51204707 14772 21499849 55137158
82219659 2795 119886 66450614
14512608 10489 32690793 59504916
7128543 8635 32417983 76142161
26155257 31971 17794475 ...

output:


result:


Subtask #6:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Dependency #3:

0%