QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#356385#8055. BalancezmTL 1663ms15648kbC++144.2kb2024-03-17 18:22:472024-03-17 18:22:48

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 12216kb

input:

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

output:

Yes
5 4 3 2 1 
No
Yes
2 3 2 2 1 
Yes
2 2 1 1 1 
No

result:

ok ok (5 test cases)

Test #2:

score: 0
Accepted
time: 696ms
memory: 12992kb

input:

100000
4 3
4 2
1 3
2 1
2 1 3 2
5 7
2 5
5 3
2 3
5 1
4 3
2 4
4 3
1 3 1 1 2
3 2
2 1
2 3
1 1 1
4 7
3 4
1 4
2 3
4 3
4 2
3 1
4 3
2 3 3 2
4 6
2 4
3 1
1 2
1 2
2 3
4 2
1 1 3 3
4 7
3 2
4 2
1 2
3 4
3 2
2 4
3 4
2 1 1 1
5 5
3 2
1 5
4 5
4 3
2 1
1 2 2 3 2
3 5
2 3
1 3
3 1
3 1
2 1
3 2 3
2 3
2 1
2 1
1 2
1 1
2 3
2 1
1...

output:

Yes
2 2 3 1 
No
Yes
1 1 1 
No
No
Yes
2 1 1 1 
No
No
Yes
1 1 
Yes
1 1 
Yes
1 1 
Yes
1 1 1 1 
No
Yes
1 1 1 1 1 
Yes
1 3 1 1 1 
Yes
1 1 1 
Yes
1 2 
Yes
1 1 1 1 1 
Yes
1 2 
No
Yes
1 1 
Yes
1 1 1 
Yes
1 1 
Yes
1 1 1 1 
Yes
1 1 
Yes
2 2 2 2 2 
Yes
1 1 1 1 1 
Yes
1 1 
Yes
1 2 1 1 
No
Yes
1 1 
No
Yes
1 1 
N...

result:

ok ok (100000 test cases)

Test #3:

score: 0
Accepted
time: 1571ms
memory: 13828kb

input:

83335
9 17
1 4
8 9
5 2
1 3
2 7
1 7
2 8
6 7
2 4
1 8
5 8
7 1
8 6
4 6
4 7
6 9
7 9
7 3 4 4 7 4 2 4 8
6 9
3 1
1 2
3 5
1 2
3 4
4 5
6 3
6 1
6 2
4 3 2 2 1 3
9 8
9 3
5 7
5 9
2 6
1 8
4 1
4 2
4 3
4 2 5 3 4 5 4 5 4
6 7
2 1
1 5
6 1
3 1
6 5
2 4
5 3
2 1 2 1 2 1
4 6
2 1
4 2
1 4
1 2
1 4
3 1
2 2 4 2
6 10
2 3
3 5
2 1
...

output:

No
No
Yes
4 3 4 4 5 2 5 4 5 
No
Yes
2 2 4 2 
No
Yes
3 3 2 3 
Yes
2 2 1 
No
Yes
1 1 1 1 1 
No
Yes
1 1 1 
Yes
1 1 3 3 3 
Yes
1 1 
Yes
1 1 
Yes
1 1 1 1 
Yes
3 1 3 
No
Yes
1 1 1 1 1 1 1 1 
Yes
1 1 1 1 1 1 1 
No
Yes
1 1 
No
Yes
1 1 1 1 1 
Yes
2 1 1 2 1 
No
Yes
1 2 3 1 3 3 3 1 
No
No
No
No
No
No
No
No
No
...

result:

ok ok (83335 test cases)

Test #4:

score: 0
Accepted
time: 1663ms
memory: 12656kb

input:

58877
11 15
10 8
4 5
8 4
9 1
3 6
5 2
4 11
3 6
11 5
5 2
9 6
1 5
5 7
5 9
8 4
1 1 1 1 1 1 1 1 1 1 1
6 11
3 4
6 1
1 3
6 1
2 6
1 2
6 2
2 1
3 6
4 5
1 3
2 4 3 2 4 4
12 21
3 10
9 10
4 6
12 10
7 8
5 9
11 9
5 8
4 6
4 9
8 2
10 3
3 4
7 6
1 2
1 8
6 12
8 5
3 1
6 4
12 8
5 2 1 4 3 5 3 1 4 6 5 1
10 9
10 7
3 2
1 4
7 ...

output:

Yes
1 1 1 1 1 1 1 1 1 1 1 
No
No
No
No
Yes
1 1 
No
No
No
Yes
1 1 1 1 
No
No
No
No
No
No
Yes
1 1 1 1 1 
No
Yes
1 1 1 1 
No
No
Yes
1 1 1 2 2 
No
No
No
No
Yes
1 1 1 1 1 1 1 1 1 1 1 1 1 
No
No
Yes
1 1 1 
No
No
No
No
Yes
1 1 
No
Yes
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 
No
No
No
No
No
No
No
No
No
No
Yes
1 1 
No...

result:

ok ok (58877 test cases)

Test #5:

score: 0
Accepted
time: 137ms
memory: 12848kb

input:

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

output:

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

result:

ok ok (50000 test cases)

Test #6:

score: 0
Accepted
time: 210ms
memory: 15648kb

input:

5000
100 99
98 18
13 98
12 13
76 12
76 68
74 80
74 58
76 80
38 21
69 38
46 69
50 67
46 50
46 78
80 67
90 93
88 99
90 60
90 88
21 90
53 96
53 87
99 96
11 42
81 85
81 11
87 85
37 3
17 37
17 26
11 3
95 8
95 15
95 59
3 15
32 24
62 40
7 62
7 32
59 7
51 25
51 56
100 51
41 100
41 86
62 25
14 84
14 16
100 1...

output:

Yes
16 16 7 20 15 15 9 8 19 16 6 1 1 11 8 11 7 1 16 16 3 20 17 9 10 7 16 20 14 13 14 9 18 20 17 16 7 3 15 9 10 6 19 14 14 3 14 19 16 3 10 14 5 20 13 10 15 2 8 4 17 9 16 20 18 20 3 1 3 15 20 17 14 2 15 1 17 3 20 2 6 17 16 11 6 10 5 4 20 4 19 13 4 20 8 5 20 1 4 10 
Yes
4 2 1 5 2 1 2 10 4 6 7 5 10 8 7 ...

result:

ok ok (5000 test cases)

Test #7:

score: 0
Accepted
time: 647ms
memory: 14336kb

input:

500
1000 999
532 116
445 532
834 445
540 432
144 540
427 834
427 144
564 261
564 427
948 692
119 111
119 429
965 316
714 975
787 714
537 787
793 537
793 119
948 793
948 965
564 692
603 575
17 603
22 759
390 22
73 390
73 17
965 759
491 790
897 491
703 69
359 703
217 359
776 557
897 776
258 897
31 258...

output:

Yes
63 18 31 27 38 42 31 9 35 15 32 23 18 85 68 9 3 49 40 16 66 3 14 16 62 76 25 19 17 55 4 19 73 89 89 43 74 8 22 59 9 51 13 9 16 84 44 47 72 33 65 90 49 48 22 63 45 89 69 73 19 68 18 20 6 37 37 61 4 77 53 24 3 81 57 36 15 45 50 82 76 21 9 50 69 47 61 13 27 23 75 26 91 53 22 33 72 24 29 68 54 73 45...

result:

ok ok (500 test cases)

Test #8:

score: -100
Time Limit Exceeded

input:

50
10000 9999
1099 7770
5310 7861
9812 3314
1099 7799
392 5622
5651 107
3262 5651
9852 1099
9852 3216
392 8051
9128 392
1141 9128
3252 9812
8671 116
2438 8671
3252 2438
5310 3252
9852 5310
7830 9852
6225 7830
213 6225
3908 213
2062 3908
4787 2062
7726 4787
6412 7726
1141 6412
1141 3262
7933 1672
355...

output:

Yes
94 95 231 265 327 297 260 44 110 330 341 225 76 418 275 132 80 416 158 300 106 248 407 174 237 166 288 189 91 200 61 127 271 153 218 198 61 353 303 3 305 306 315 201 189 11 12 385 231 196 366 380 73 418 119 64 288 163 396 325 399 185 26 263 252 46 306 240 137 372 103 411 415 112 256 254 247 332 ...

result: