QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#62468#4329. Mjcelin20 702ms73484kbC++144.6kb2022-11-19 08:27:452022-11-19 08:27:47

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 10
Accepted
time: 2ms
memory: 18752kb

input:

2 0
1
1 2

output:

-1

result:

ok single line: '-1'

Test #2:

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

input:

2 1
1 2
1
1 2

output:

-1

result:

ok single line: '-1'

Test #3:

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

input:

2 2
1 2
1 2
1
1 2

output:

2

result:

ok single line: '2'

Test #4:

score: 0
Accepted
time: 33ms
memory: 46628kb

input:

286524 0
1
202914 240681

output:

-1

result:

ok single line: '-1'

Test #5:

score: 0
Accepted
time: 97ms
memory: 33668kb

input:

700 244650
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 ...

output:

1374

result:

ok single line: '1374'

Test #6:

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

input:

276660 276659
2 1
3 2
4 3
5 1
6 2
7 6
8 7
9 4
10 1
11 7
12 5
13 10
14 5
15 8
16 8
17 5
18 17
19 4
20 16
21 2
22 14
23 17
24 19
25 11
26 7
27 5
28 21
29 25
30 4
31 9
32 7
33 14
34 4
35 11
36 31
37 23
38 20
39 23
40 20
41 24
42 31
43 12
44 1
45 13
46 5
47 12
48 39
49 16
50 41
51 8
52 46
53 9
54 51
55 ...

output:

-1

result:

ok single line: '-1'

Test #7:

score: 0
Accepted
time: 105ms
memory: 73484kb

input:

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

output:

276660

result:

ok single line: '276660'

Test #8:

score: 0
Accepted
time: 166ms
memory: 41076kb

input:

100 296786
95 34
21 83
7 5
38 11
99 60
10 53
61 42
54 34
49 63
83 44
76 74
39 52
24 58
16 65
73 100
92 82
48 42
68 88
81 83
46 6
68 72
15 81
36 74
62 71
45 55
58 13
9 96
23 41
83 72
47 100
55 26
79 68
74 60
73 72
80 94
89 36
83 26
31 41
39 73
47 41
72 99
37 46
93 38
74 71
25 9
68 40
6 78
86 77
50 29...

output:

169

result:

ok single line: '169'

Test #9:

score: -10
Wrong Answer
time: 165ms
memory: 41028kb

input:

100 272289
23 78
32 44
98 73
46 98
31 54
27 51
9 8
42 27
2 50
53 68
87 81
34 39
40 7
68 29
68 91
70 22
35 46
93 94
27 3
76 61
26 96
86 24
18 55
80 91
94 14
45 53
39 76
36 67
20 47
11 21
49 50
62 38
96 48
35 37
28 84
45 77
96 32
18 58
15 28
9 46
55 36
32 66
29 38
93 46
44 72
99 91
80 19
35 75
31 43
5...

output:

530

result:

wrong answer 1st lines differ - expected: '96', found: '530'

Subtask #2:

score: 20
Accepted

Test #23:

score: 20
Accepted
time: 6ms
memory: 18512kb

input:

2 2
1 2
1 2
1
1 2

output:

2

result:

ok single line: '2'

Test #24:

score: 0
Accepted
time: 110ms
memory: 46264kb

input:

282511 0
299916
203511 263473
33 36199
85417 282256
41463 66702
26089 112045
52624 109596
97631 189221
112098 264315
152230 239106
118434 88509
193593 148199
57764 125288
248092 64862
7738 150987
189425 258219
117900 129173
157845 121684
39664 265329
55969 219916
226232 202281
273560 226801
88551 26...

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 299916 lines

Test #25:

score: 0
Accepted
time: 276ms
memory: 52788kb

input:

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

output:

65534
262140
262142
131066
90106
65532
196604
131070
131068
196604
262140
262142
262142
262142
262140
262142
262142
262142
65534
262140
131070
131068
32762
49148
262142
262142
65534
262142
262142
131070
131070
262142
262142
262140
262142
262140
262140
65534
262142
262138
135164
262142
262142
262142
...

result:

ok 283080 lines

Test #26:

score: 0
Accepted
time: 675ms
memory: 46868kb

input:

143262 286522
2 1
2 1
3 2
3 2
4 3
4 3
5 2
5 2
6 1
6 1
7 4
7 4
8 4
8 4
9 8
9 8
10 4
10 4
11 9
11 9
12 1
12 1
13 2
13 2
14 1
14 1
15 3
15 3
16 4
16 4
17 1
17 1
18 2
18 2
19 8
19 8
20 14
20 14
21 1
21 1
22 4
22 4
23 11
23 11
24 11
24 11
25 16
25 16
26 6
26 6
27 8
27 8
28 10
28 10
29 19
29 19
30 15
30 1...

output:

243704
138692
259300
170980
230262
221118
284100
253140
207246
81998
167430
226110
171158
275498
143732
104800
268692
103034
283436
160896
64300
155868
268492
234180
99974
258846
257454
201076
235588
274206
103822
227234
258742
274094
163676
158910
104054
275814
201386
223022
232914
278242
214212
72...

result:

ok 284324 lines

Test #27:

score: 0
Accepted
time: 702ms
memory: 48428kb

input:

149506 299010
2 1
2 1
3 2
3 2
4 1
4 1
5 4
5 4
6 5
6 5
7 5
7 5
8 5
8 5
9 6
9 6
10 6
10 6
11 3
11 3
12 2
12 2
13 12
13 12
14 3
14 3
15 1
15 1
16 11
16 11
17 5
17 5
18 16
18 16
19 8
19 8
20 13
20 13
21 16
21 16
22 1
22 1
23 5
23 5
24 14
24 14
25 21
25 21
26 10
26 10
27 26
27 26
28 17
28 17
29 5
29 5
30...

output:

126372
184008
130688
216656
200698
277824
157364
293054
147204
90734
183888
261544
48536
200672
233614
100642
230388
282434
141194
193866
111810
216344
273724
277738
20248
294630
73670
241736
265510
238504
236590
112390
258606
198914
161768
225374
272210
96384
248092
193734
112206
230950
210078
1681...

result:

ok 286601 lines

Test #28:

score: 0
Accepted
time: 697ms
memory: 45952kb

input:

138330 276658
2 1
2 1
3 2
3 2
4 3
4 3
5 1
5 1
6 2
6 2
7 6
7 6
8 7
8 7
9 4
9 4
10 1
10 1
11 7
11 7
12 5
12 5
13 10
13 10
14 5
14 5
15 8
15 8
16 8
16 8
17 5
17 5
18 17
18 17
19 4
19 4
20 16
20 16
21 2
21 2
22 14
22 14
23 17
23 17
24 19
24 19
25 11
25 11
26 7
26 7
27 5
27 5
28 21
28 21
29 25
29 25
30 4...

output:

271092
270266
247406
224086
224788
177734
268764
258366
260418
191882
160972
128138
176694
232406
228618
193744
241546
60258
169824
236956
32258
180052
251726
226304
94000
80438
187174
242122
266710
172962
275490
204436
233174
199674
115448
176782
166706
275638
97914
201624
253330
249894
252344
1313...

result:

ok 275339 lines

Test #29:

score: 0
Accepted
time: 672ms
memory: 48040kb

input:

148393 296784
2 1
2 1
3 1
3 1
4 1
4 1
5 4
5 4
6 1
6 1
7 1
7 1
8 3
8 3
9 1
9 1
10 9
10 9
11 6
11 6
12 2
12 2
13 7
13 7
14 8
14 8
15 6
15 6
16 8
16 8
17 6
17 6
18 9
18 9
19 12
19 12
20 16
20 16
21 9
21 9
22 16
22 16
23 17
23 17
24 9
24 9
25 13
25 13
26 6
26 6
27 16
27 16
28 5
28 5
29 19
29 19
30 22
30...

output:

162314
266916
234100
259698
261364
261244
87300
158144
292360
209656
296436
152934
109548
239472
86604
282858
281198
182084
154048
216164
288156
159408
121264
192406
168696
202852
251708
64516
167480
261154
290986
131508
164242
97022
279326
228156
53852
293826
206386
213218
107666
109112
175964
2210...

result:

ok 278983 lines

Test #30:

score: 0
Accepted
time: 673ms
memory: 45636kb

input:

136144 272286
2 1
2 1
3 2
3 2
4 1
4 1
5 2
5 2
6 5
6 5
7 5
7 5
8 4
8 4
9 8
9 8
10 3
10 3
11 6
11 6
12 3
12 3
13 7
13 7
14 2
14 2
15 2
15 2
16 7
16 7
17 5
17 5
18 1
18 1
19 9
19 9
20 11
20 11
21 14
21 14
22 19
22 19
23 18
23 18
24 8
24 8
25 10
25 10
26 10
26 10
27 2
27 2
28 19
28 19
29 9
29 9
30 20
30...

output:

173036
244354
261170
242596
169974
262894
222572
233872
212394
218198
244058
254366
199332
177626
9160
264988
33570
116578
179736
163786
191906
63066
148194
255536
119578
106780
214876
195670
249194
226530
233962
219002
215724
181416
154480
254588
153998
114734
235500
257740
137806
236204
218402
110...

result:

ok 285431 lines

Test #31:

score: 0
Accepted
time: 686ms
memory: 48028kb

input:

148102 296202
2 1
2 1
3 2
3 2
4 1
4 1
5 4
5 4
6 2
6 2
7 4
7 4
8 6
8 6
9 2
9 2
10 4
10 4
11 1
11 1
12 7
12 7
13 6
13 6
14 10
14 10
15 6
15 6
16 7
16 7
17 9
17 9
18 15
18 15
19 9
19 9
20 18
20 18
21 12
21 12
22 4
22 4
23 12
23 12
24 17
24 17
25 19
25 19
26 11
26 11
27 19
27 19
28 23
28 23
29 18
29 18
...

output:

286674
289806
190192
267264
150966
237022
204114
266250
265372
246570
240690
151438
264772
247546
174884
260114
236976
232560
224592
97318
290680
284692
66988
280030
83922
265662
135508
197924
170488
111168
198650
95790
108394
129586
145938
293576
231004
275172
273336
282194
296132
264346
233524
288...

result:

ok 279989 lines

Test #32:

score: 0
Accepted
time: 683ms
memory: 45360kb

input:

135155 270308
2 1
2 1
3 2
3 2
4 2
4 2
5 2
5 2
6 1
6 1
7 1
7 1
8 3
8 3
9 2
9 2
10 1
10 1
11 3
11 3
12 10
12 10
13 6
13 6
14 2
14 2
15 4
15 4
16 3
16 3
17 2
17 2
18 7
18 7
19 7
19 7
20 10
20 10
21 4
21 4
22 7
22 7
23 20
23 20
24 9
24 9
25 23
25 23
26 19
26 19
27 2
27 2
28 27
28 27
29 20
29 20
30 21
30...

output:

139090
233160
159888
87110
183310
268560
260806
246980
192900
208248
232106
51752
34360
264832
223378
236612
42998
256620
75092
104964
167878
168338
203256
197720
233884
105312
200512
258278
202358
130266
227448
203206
230338
29402
138246
217456
209670
190216
148026
180232
193458
120586
154762
23230...

result:

ok 299524 lines

Test #33:

score: 0
Accepted
time: 277ms
memory: 56660kb

input:

146570 293138
2 1
2 1
3 2
3 2
4 3
4 3
5 4
5 4
6 5
6 5
7 6
7 6
8 7
8 7
9 8
9 8
10 9
10 9
11 10
11 10
12 11
12 11
13 12
13 12
14 13
14 13
15 14
15 14
16 15
16 15
17 16
17 16
18 17
18 17
19 18
19 18
20 19
20 19
21 20
21 20
22 21
22 21
23 22
23 22
24 23
24 23
25 24
25 24
26 25
26 25
27 26
27 26
28 27
28...

output:

144984
185748
243868
170994
65896
207898
222942
77272
44082
200906
279478
98516
261134
238212
179556
257264
213240
269036
209472
159042
228276
171164
197616
242158
127226
181092
150422
190658
224386
236044
179386
266362
164056
98348
120534
33412
250062
128978
183590
214502
240166
224804
251178
10308...

result:

ok 278963 lines

Subtask #3:

score: 0
Wrong Answer

Test #34:

score: 30
Accepted
time: 6ms
memory: 18744kb

input:

2 0
1
1 2

output:

-1

result:

ok single line: '-1'

Test #35:

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

input:

2 1
1 2
1
1 2

output:

-1

result:

ok single line: '-1'

Test #36:

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

input:

2 2
1 2
1 2
1
1 2

output:

2

result:

ok single line: '2'

Test #37:

score: 0
Accepted
time: 60ms
memory: 19108kb

input:

4775 0
272121
3382 4011
1390 580
2440 2719
4264 2087
4280 90
600 195
990 1184
246 447
2105 3318
143 695
2182 2164
3100 1030
1330 1690
3230 2353
2822 4362
115 3657
2669 4650
1238 1922
1983 2640
1354 1463
3310 2802
2104 1313
750 2171
2601 3618
3727 3904
1463 1230
1060 4265
1853 3431
4472 99
4661 682
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 272121 lines

Test #38:

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

input:

100 4950
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
1 10
1 11
1 12
1 13
1 14
1 15
1 16
1 17
1 18
1 19
1 20
1 21
1 22
1 23
1 24
1 25
1 26
1 27
1 28
1 29
1 30
1 31
1 32
1 33
1 34
1 35
1 36
1 37
1 38
1 39
1 40
1 41
1 42
1 43
1 44
1 45
1 46
1 47
1 48
1 49
1 50
1 51
1 52
1 53
1 54
1 55
1 56
1 57
1 58
1 59
1 60
1 61...

output:

100
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
...

result:

ok 4950 lines

Test #39:

score: 0
Accepted
time: 290ms
memory: 19228kb

input:

4611 4610
2 1
3 2
4 3
5 1
6 2
7 6
8 7
9 4
10 1
11 7
12 5
13 10
14 5
15 8
16 8
17 5
18 17
19 4
20 16
21 2
22 14
23 17
24 19
25 11
26 7
27 5
28 21
29 25
30 4
31 9
32 7
33 14
34 4
35 11
36 31
37 23
38 20
39 23
40 20
41 24
42 31
43 12
44 1
45 13
46 5
47 12
48 39
49 16
50 41
51 8
52 46
53 9
54 51
55 53
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
...

result:

ok 285901 lines

Test #40:

score: 0
Accepted
time: 123ms
memory: 19432kb

input:

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

output:

4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
4611
...

result:

ok 271655 lines

Test #41:

score: -30
Wrong Answer
time: 155ms
memory: 18804kb

input:

100 4947
95 34
21 83
7 5
38 11
99 60
10 53
61 42
54 34
49 63
83 44
76 74
39 52
24 58
16 65
73 100
92 82
48 42
68 88
81 83
46 6
68 72
15 81
36 74
62 71
45 55
58 13
9 96
23 41
83 72
47 100
55 26
79 68
74 60
73 72
80 94
89 36
83 26
31 41
39 73
47 41
72 99
37 46
93 38
74 71
25 9
68 40
6 78
86 77
50 29
5...

output:

696
356
200
696
696
696
217
696
378
384
725
485
173
171
356
259
696
696
259
259
696
378
696
200
259
696
173
259
696
200
696
485
200
80
324
485
140
113
77
658
256
696
166
324
378
96
167
200
171
696
111
485
696
356
170
324
108
485
485
86
696
200
356
378
696
696
110
114
196
696
324
140
485
275
275
114
...

result:

wrong answer 1st lines differ - expected: '128', found: '696'

Subtask #4:

score: 0
Skipped

Dependency #1:

0%