QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#639256#9251. Graph Changingucup-team2462WA 2ms4868kbC++202.1kb2024-10-13 18:34:182024-10-13 18:34:19

详细

Test #1:

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

input:

5
1 5 3 2 4
1 10 4 2 4
2 10 5 2 4
1 3 2 1 3
1 3 2 1 2

output:

3
2
-1
1
-1

result:

ok 5 lines

Test #2:

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

input:

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

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

result:

ok 30 lines

Test #3:

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

input:

90
1 3 1 1 2
1 3 1 1 3
1 3 1 2 3
1 3 2 1 2
1 3 2 1 3
1 3 2 2 3
1 3 3 1 2
1 3 3 1 3
1 3 3 2 3
1 3 4 1 2
1 3 4 1 3
1 3 4 2 3
1 3 5 1 2
1 3 5 1 3
1 3 5 2 3
1 3 6 1 2
1 3 6 1 3
1 3 6 2 3
2 3 1 1 2
2 3 1 1 3
2 3 1 2 3
2 3 2 1 2
2 3 2 1 3
2 3 2 2 3
2 3 3 1 2
2 3 3 1 3
2 3 3 2 3
2 3 4 1 2
2 3 4 1 3
2 3 4 2...

output:

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

result:

ok 1080 lines

Test #10:

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

input:

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

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

result:

ok 1350 lines

Test #11:

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

input:

1650
1 11 1 1 2
1 11 1 1 3
1 11 1 1 4
1 11 1 1 5
1 11 1 1 6
1 11 1 1 7
1 11 1 1 8
1 11 1 1 9
1 11 1 1 10
1 11 1 1 11
1 11 1 2 3
1 11 1 2 4
1 11 1 2 5
1 11 1 2 6
1 11 1 2 7
1 11 1 2 8
1 11 1 2 9
1 11 1 2 10
1 11 1 2 11
1 11 1 3 4
1 11 1 3 5
1 11 1 3 6
1 11 1 3 7
1 11 1 3 8
1 11 1 3 9
1 11 1 3 10
1 11...

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

result:

ok 1650 lines

Test #12:

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

input:

1980
1 12 1 1 2
1 12 1 1 3
1 12 1 1 4
1 12 1 1 5
1 12 1 1 6
1 12 1 1 7
1 12 1 1 8
1 12 1 1 9
1 12 1 1 10
1 12 1 1 11
1 12 1 1 12
1 12 1 2 3
1 12 1 2 4
1 12 1 2 5
1 12 1 2 6
1 12 1 2 7
1 12 1 2 8
1 12 1 2 9
1 12 1 2 10
1 12 1 2 11
1 12 1 2 12
1 12 1 3 4
1 12 1 3 5
1 12 1 3 6
1 12 1 3 7
1 12 1 3 8
1 1...

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

result:

ok 1980 lines

Test #13:

score: -100
Wrong Answer
time: 2ms
memory: 4792kb

input:

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

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

result:

wrong answer 358th lines differ - expected: '3', found: '2'