QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#549561#2603. DisbalanceUrdTL 54ms19348kbC++171.5kb2024-09-06 17:34:512024-09-06 17:34:51

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 20ms
memory: 19268kb

input:

8
1 1
1 2
2 1
2 2
3 1
3 2
3 3
4 3

output:

2
5
1
332748120
0
499122177
299473307
598946612

result:

ok 8 numbers

Test #2:

score: 0
Accepted
time: 20ms
memory: 19180kb

input:

20
9 12
2 6
9 14
3 7
1 2
1 2
10 11
6 7
10 13
7 4
1 3
4 4
2 2
1 5
10 9
6 10
7 5
7 4
10 7
4 3

output:

601023541
104577993
588440629
323241035
5
5
537116365
615800088
583321633
0
9
570425345
332748120
20
334869712
974144215
0
0
0
598946612

result:

ok 20 numbers

Test #3:

score: 0
Accepted
time: 16ms
memory: 19204kb

input:

20
7 12
8 12
1 1
1 6
2 11
5 4
6 13
7 13
6 8
1 5
7 13
2 8
3 10
8 9
5 3
1 2
5 6
10 8
4 3
3 3

output:

269558826
522207092
2
27
245743886
926941185
375649298
628061442
401724376
20
628061442
880990276
368615785
683801260
0
5
126761188
0
598946612
299473307

result:

ok 20 numbers

Test #4:

score: 0
Accepted
time: 13ms
memory: 19348kb

input:

20
1 5
2 5
10 12
10 12
3 3
9 11
6 7
1 8
8 8
1 3
9 5
9 9
3 6
2 4
10 13
10 9
3 9
5 7
7 6
6 8

output:

20
532396998
374710197
374710197
299473307
973433586
615800088
44
278918935
9
0
347599278
655989151
532396995
583321633
334869712
867737959
671258108
688183607
401724376

result:

ok 20 numbers

Test #5:

score: 0
Accepted
time: 17ms
memory: 19332kb

input:

20
2 6
8 10
7 4
3 5
9 9
10 6
2 4
9 13
4 3
8 14
10 13
3 11
5 10
2 11
4 9
5 7
6 8
1 6
8 9
6 13

output:

104577993
760178656
0
156866973
347599278
0
532396995
543627802
598946612
180187355
583321633
522191842
831814893
245743886
907494870
671258108
401724376
27
683801260
375649298

result:

ok 20 numbers

Test #6:

score: 0
Accepted
time: 16ms
memory: 19204kb

input:

20
1 2
4 5
5 10
8 11
5 11
8 14
6 9
8 7
4 12
9 9
7 5
7 8
3 6
10 15
1 8
2 4
4 6
3 2
8 6
4 6

output:

5
142606337
831814893
900203882
627046821
180187355
485493133
134960775
7
347599278
0
877826765
655989151
295767061
44
532396995
332748119
499122177
0
332748119

result:

ok 20 numbers

Test #7:

score: 0
Accepted
time: 17ms
memory: 19208kb

input:

20
6 6
2 8
4 10
8 14
9 6
9 6
9 12
3 2
7 6
4 11
7 4
6 5
9 13
4 10
1 9
2 2
7 7
6 10
7 11
6 4

output:

101552997
880990276
691092249
180187355
0
0
601023541
499122177
688183607
614304223
0
308980395
543627802
691092249
54
332748120
661424143
974144215
328279082
0

result:

ok 20 numbers

Test #8:

score: 0
Accepted
time: 12ms
memory: 19324kb

input:

20
4 11
2 11
8 11
7 9
3 3
9 14
4 11
8 14
3 5
1 6
8 12
8 8
3 11
1 5
3 11
3 9
6 4
6 7
6 13
3 9

output:

614304223
245743886
900203882
176961499
299473307
588440629
614304223
180187355
156866973
27
522207092
278918935
522191842
20
522191842
867737959
0
615800088
375649298
867737959

result:

ok 20 numbers

Test #9:

score: 0
Accepted
time: 20ms
memory: 19288kb

input:

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

output:

54
831814893
368615785
448034137
570425345
347599278
532396995
176961499
127924645
332748122
598946612
0
661424143
9
489759135
499122177
543627802
2
269558826
101552997

result:

ok 20 numbers

Test #10:

score: 0
Accepted
time: 16ms
memory: 19268kb

input:

20
8 10
3 9
3 7
8 7
2 7
7 7
2 2
7 7
5 3
7 6
9 14
3 2
10 15
5 7
10 10
5 8
5 3
9 14
4 3
10 9

output:

760178656
867737959
323241035
134960775
104577997
661424143
332748120
661424143
0
688183607
588440629
499122177
295767061
671258108
56894028
489759135
0
588440629
598946612
334869712

result:

ok 20 numbers

Test #11:

score: 0
Accepted
time: 16ms
memory: 19328kb

input:

20
2 11
1 8
4 10
2 2
8 12
3 2
6 8
5 8
9 10
9 6
9 7
9 14
3 5
2 9
1 2
6 10
1 6
4 3
4 7
1 7

output:

245743886
44
691092249
332748120
522207092
499122177
401724376
489759135
38188698
0
0
588440629
156866973
880990281
5
974144215
27
598946612
2
35

result:

ok 20 numbers

Test #12:

score: 0
Accepted
time: 20ms
memory: 19328kb

input:

20
4 6
3 9
4 9
10 9
9 5
5 6
3 7
10 7
3 9
9 13
3 11
3 6
8 13
8 6
9 11
10 11
3 11
8 5
9 5
3 4

output:

332748119
867737959
907494870
334869712
0
126761188
323241035
0
867737959
543627802
522191842
655989151
448034137
0
973433586
537116365
522191842
0
0
299473308

result:

ok 20 numbers

Test #13:

score: 0
Accepted
time: 16ms
memory: 19328kb

input:

20
9 7
5 9
9 11
7 13
5 11
8 11
1 7
5 9
3 11
6 6
4 6
9 13
7 13
6 11
2 6
6 13
6 8
5 7
2 6
5 11

output:

0
524662784
973433586
628061442
627046821
900203882
35
524662784
522191842
101552997
332748119
543627802
628061442
897356188
104577993
375649298
401724376
671258108
104577993
627046821

result:

ok 20 numbers

Test #14:

score: 0
Accepted
time: 16ms
memory: 19200kb

input:

20
6 12
5 7
10 13
3 6
3 4
3 5
7 9
1 2
4 5
2 4
4 9
10 6
3 10
5 11
8 6
3 3
2 4
6 13
2 6
8 8

output:

581170194
671258108
583321633
655989151
299473308
156866973
176961499
5
142606337
532396995
907494870
0
368615785
627046821
0
299473307
532396995
375649298
104577993
278918935

result:

ok 20 numbers

Test #15:

score: 0
Accepted
time: 35ms
memory: 19276kb

input:

300000
1 5
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 5
1 6
1 6
1 6
1 6
1 5
1 6
1 6
1 5
1 6
1 6
1 6
1 6
1 6
1 5
1 6
1 6
1 6
1 5
1 6
1 5
1 6
1 6
1 6
1 6
1 5
1 5
1 5
1 5
1 6
1 6
1 6
1 5
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 5
1 6
1 5
1 6
1 6
1 6
1 6
1 5
1 6
1 6
1 6
1 6
1 6
1 6
1 6
1 5
1 6
1 6
1 6
1 6
1 5
1 6
1 5
1...

output:

20
27
27
27
27
27
27
27
20
27
27
27
27
20
27
27
20
27
27
27
27
27
20
27
27
27
20
27
20
27
27
27
27
20
20
20
20
27
27
27
20
27
27
27
27
27
27
27
27
27
20
27
20
27
27
27
27
20
27
27
27
27
27
27
27
20
27
27
27
27
20
27
20
27
20
27
20
20
27
20
20
27
27
27
27
27
20
20
20
27
20
27
27
20
20
27
20
27
27
27
...

result:

ok 300000 numbers

Test #16:

score: 0
Accepted
time: 41ms
memory: 19216kb

input:

300000
6 1
5 1
6 1
6 1
6 1
6 1
6 1
5 1
6 1
5 1
6 1
6 1
6 1
6 1
5 1
6 1
6 1
5 1
6 1
6 1
6 1
5 1
5 1
6 1
6 1
5 1
6 1
5 1
5 1
5 1
6 1
6 1
5 1
5 1
5 1
6 1
5 1
5 1
5 1
6 1
6 1
5 1
6 1
5 1
6 1
5 1
5 1
6 1
6 1
6 1
6 1
6 1
6 1
6 1
6 1
6 1
6 1
6 1
5 1
5 1
6 1
6 1
5 1
6 1
5 1
5 1
6 1
5 1
6 1
5 1
6 1
6 1
6 1
5...

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 300000 numbers

Test #17:

score: 0
Accepted
time: 54ms
memory: 19220kb

input:

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

output:

299473307
532396998
27
0
27
27
0
0
27
532396998
0
0
532396998
27
27
20
299473308
598946612
27
0
598946612
20
0
0
27
598946612
0
27
0
532396998
27
598946612
532396995
532396998
0
598946612
532396998
532396998
27
598946612
27
532396995
299473307
299473308
532396995
598946612
299473307
598946612
27
0
0...

result:

ok 300000 numbers

Test #18:

score: 0
Accepted
time: 24ms
memory: 19212kb

input:

1
1000000 1000000

output:

509847430

result:

ok 1 number(s): "509847430"

Test #19:

score: 0
Accepted
time: 16ms
memory: 19260kb

input:

2
1 1000000
1 999998

output:

879323500
877323499

result:

ok 2 number(s): "879323500 877323499"

Test #20:

score: 0
Accepted
time: 16ms
memory: 19268kb

input:

2
1000000 1
999998 1

output:

0
0

result:

ok 2 number(s): "0 0"

Test #21:

score: -100
Time Limit Exceeded

input:

2
2 1000000
2 999996

output:


result: