QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#584458#9182. Infinite RaceHuangHanSheng29 32ms5892kbC++20506b2024-09-23 14:22:192024-09-23 14:22:20

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 29
Accepted

Test #1:

score: 29
Accepted
time: 1ms
memory: 5552kb

input:

2
1
1

output:

0

result:

ok single line: '0'

Test #2:

score: 29
Accepted
time: 0ms
memory: 3604kb

input:

2
2
1
-1

output:

0

result:

ok single line: '0'

Test #3:

score: 29
Accepted
time: 1ms
memory: 5584kb

input:

2
5
-1
-1
-1
-1
1

output:

0

result:

ok single line: '0'

Test #4:

score: 29
Accepted
time: 14ms
memory: 4316kb

input:

2
200000
1
1
-1
-1
-1
1
-1
1
1
1
-1
-1
1
-1
1
1
-1
1
1
-1
-1
1
-1
-1
1
-1
1
-1
1
1
1
1
-1
1
-1
-1
-1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
1
-1
-1
-1
-1
-1
1
-1
-1
1
1
1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
1
-1
1
-1
1
-1
-1
1
-1
1
1
-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:

50154

result:

ok single line: '50154'

Test #5:

score: 29
Accepted
time: 22ms
memory: 4456kb

input:

2
200000
1
-1
1
-1
1
1
-1
1
-1
-1
1
-1
1
1
1
1
-1
-1
1
1
1
1
-1
1
-1
1
1
1
-1
-1
1
-1
-1
-1
1
1
1
1
-1
1
1
1
-1
1
1
1
-1
1
1
1
-1
1
1
1
1
1
1
1
-1
-1
1
1
-1
-1
-1
1
-1
-1
-1
-1
-1
1
-1
-1
-1
-1
1
1
1
1
-1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
1
-1
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:

50172

result:

ok single line: '50172'

Test #6:

score: 29
Accepted
time: 18ms
memory: 4388kb

input:

2
200000
1
1
1
1
1
1
1
1
-1
1
1
1
1
-1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-1
1
-1
1
-1
1
-1
-1
1
1
1
1
1
-1
1
1
1
-1
-1
-1
1
-1
1
1
-1
-1
1
-1
1
1
-1
1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
1
1
-1
-1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
1
-1
1
1
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:

49713

result:

ok single line: '49713'

Test #7:

score: 29
Accepted
time: 23ms
memory: 4416kb

input:

2
200000
1
-1
-1
1
-1
1
-1
1
1
-1
1
-1
-1
-1
-1
-1
-1
-1
1
1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-1
1
1
-1
1
-1
1
1
1
1
-1
-1
1
-1
-1
1
1
1
1
-1
-1
1
-1
-1
1
1
-1
1
-1
1
1
1
-1
-1
-1
-1
-1
1
1
-1
-1
1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
1
-1
-1
-1
1
1
1
-1
1
1
-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:

49564

result:

ok single line: '49564'

Test #8:

score: 29
Accepted
time: 0ms
memory: 3696kb

input:

2
100
-1
1
-1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
1
1
1
1
1
1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
-1
1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
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:

16

result:

ok single line: '16'

Test #9:

score: 29
Accepted
time: 0ms
memory: 3508kb

input:

2
2
1
1

output:

1

result:

ok single line: '1'

Test #10:

score: 29
Accepted
time: 17ms
memory: 4412kb

input:

2
200000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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:

199999

result:

ok single line: '199999'

Test #11:

score: 29
Accepted
time: 0ms
memory: 5588kb

input:

2
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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:

99

result:

ok single line: '99'

Test #12:

score: 29
Accepted
time: 20ms
memory: 4288kb

input:

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

result:

ok single line: '0'

Test #13:

score: 29
Accepted
time: 0ms
memory: 3544kb

input:

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

result:

ok single line: '0'

Test #14:

score: 29
Accepted
time: 18ms
memory: 4416kb

input:

2
200000
1
1
1
1
1
1
1
1
1
-1
1
1
-1
-1
-1
1
1
1
-1
1
-1
1
-1
-1
-1
1
-1
1
1
-1
-1
-1
-1
1
1
1
-1
-1
1
-1
1
1
1
1
1
1
-1
1
-1
1
1
-1
-1
-1
1
1
-1
1
1
-1
-1
-1
-1
-1
-1
-1
1
-1
1
1
1
1
1
1
-1
1
-1
-1
-1
1
-1
1
-1
-1
1
1
-1
1
-1
1
1
-1
-1
1
1
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:

50402

result:

ok single line: '50402'

Test #15:

score: 29
Accepted
time: 0ms
memory: 3608kb

input:

2
100
1
1
1
-1
1
1
1
-1
-1
-1
-1
1
-1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
-1
1
-1
1
-1
-1
1
-1
1
1
1
-1
-1
-1
1
1
1
1
1
1
-1
1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
1
1
-1
-1
1
1
1
1
-1
-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:

27

result:

ok single line: '27'

Test #16:

score: 29
Accepted
time: 22ms
memory: 4316kb

input:

2
200000
1
-1
1
-1
-1
-1
1
1
1
1
1
1
-1
-1
1
1
1
-1
1
1
1
-1
1
-1
1
1
1
1
-1
-1
1
-1
1
-1
-1
1
1
1
1
1
1
-1
-1
1
-1
1
-1
-1
1
-1
1
-1
1
1
-1
-1
1
-1
1
-1
1
1
-1
1
1
1
1
1
1
-1
-1
-1
-1
1
-1
1
1
-1
1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
-1
1
-1
-1
-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:

49885

result:

ok single line: '49885'

Test #17:

score: 29
Accepted
time: 0ms
memory: 3548kb

input:

2
100
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
1
1
-1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
-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:

84

result:

ok single line: '84'

Test #18:

score: 29
Accepted
time: 17ms
memory: 4328kb

input:

2
200000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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:

199987

result:

ok single line: '199987'

Test #19:

score: 29
Accepted
time: 1ms
memory: 5592kb

input:

2
4
1
1
1
1

output:

3

result:

ok single line: '3'

Test #20:

score: 29
Accepted
time: 0ms
memory: 3544kb

input:

2
5
1
-1
1
-1
-1

output:

0

result:

ok single line: '0'

Subtask #2:

score: 0
Wrong Answer

Test #21:

score: 34
Accepted
time: 0ms
memory: 3700kb

input:

2
2
1
1

output:

1

result:

ok single line: '1'

Test #22:

score: 34
Accepted
time: 14ms
memory: 4320kb

input:

2
200000
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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:

199999

result:

ok single line: '199999'

Test #23:

score: 34
Accepted
time: 0ms
memory: 3544kb

input:

2
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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:

99

result:

ok single line: '99'

Test #24:

score: 34
Accepted
time: 1ms
memory: 5596kb

input:

100
100
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
1

output:

1

result:

ok single line: '1'

Test #25:

score: 34
Accepted
time: 32ms
memory: 5892kb

input:

200000
200000
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
9...

output:

1

result:

ok single line: '1'

Test #26:

score: 34
Accepted
time: 0ms
memory: 3612kb

input:

200000
1
182487

output:

0

result:

ok single line: '0'

Test #27:

score: 0
Wrong Answer
time: 18ms
memory: 4324kb

input:

3
200000
1
2
1
2
2
2
1
1
1
2
2
2
1
2
2
2
2
1
1
2
2
1
2
2
1
2
2
1
2
1
1
2
2
2
2
2
1
2
2
2
1
1
2
1
1
2
2
1
2
2
1
2
2
1
1
2
2
2
2
2
2
1
2
1
1
1
2
1
1
2
1
1
1
2
1
1
2
2
2
1
1
1
1
2
1
2
2
1
2
1
2
1
2
1
2
2
2
1
2
2
2
1
1
1
1
2
1
1
2
2
2
2
1
2
1
2
1
1
2
2
1
1
1
1
1
1
2
2
1
1
1
1
1
1
1
2
2
2
2
2
2
1
1
1
2
2...

output:

100143

result:

wrong answer 1st lines differ - expected: '133415', found: '100143'

Subtask #3:

score: 0
Wrong Answer

Test #45:

score: 22
Accepted
time: 0ms
memory: 3680kb

input:

2
1
1

output:

0

result:

ok single line: '0'

Test #46:

score: 22
Accepted
time: 0ms
memory: 3620kb

input:

2
2
1
-1

output:

0

result:

ok single line: '0'

Test #47:

score: 22
Accepted
time: 0ms
memory: 3544kb

input:

2
5
-1
-1
-1
-1
1

output:

0

result:

ok single line: '0'

Test #48:

score: 22
Accepted
time: 1ms
memory: 5552kb

input:

2
100
-1
1
-1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
1
1
1
1
1
1
-1
-1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
-1
1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
1
-1
-1
1
1
-1
-1
-1
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:

16

result:

ok single line: '16'

Test #49:

score: 22
Accepted
time: 0ms
memory: 3548kb

input:

2
2
1
1

output:

1

result:

ok single line: '1'

Test #50:

score: 22
Accepted
time: 0ms
memory: 3608kb

input:

2
100
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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:

99

result:

ok single line: '99'

Test #51:

score: 22
Accepted
time: 1ms
memory: 5736kb

input:

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

result:

ok single line: '0'

Test #52:

score: 22
Accepted
time: 0ms
memory: 3628kb

input:

2
100
1
1
1
-1
1
1
1
-1
-1
-1
-1
1
-1
1
1
1
-1
-1
1
1
-1
-1
-1
-1
-1
1
-1
1
-1
-1
1
-1
1
1
1
-1
-1
-1
1
1
1
1
1
1
-1
1
1
-1
-1
-1
-1
1
-1
-1
-1
1
-1
-1
1
-1
-1
-1
-1
1
1
1
-1
1
1
-1
-1
1
1
1
1
-1
-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:

27

result:

ok single line: '27'

Test #53:

score: 22
Accepted
time: 0ms
memory: 3540kb

input:

2
100
1
1
1
1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
1
1
-1
-1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
-1
1
1
1
1
-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:

84

result:

ok single line: '84'

Test #54:

score: 22
Accepted
time: 0ms
memory: 3640kb

input:

100
100
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
1

output:

1

result:

ok single line: '1'

Test #55:

score: 0
Wrong Answer
time: 0ms
memory: 3696kb

input:

100
100
92
24
44
6
56
47
78
13
79
24
86
40
7
40
3
33
1
63
9
82
73
40
4
92
88
1
9
77
24
27
22
74
55
26
49
99
64
28
20
49
62
11
78
10
69
76
93
96
18
65
20
2
91
4
81
61
41
29
18
3
93
6
31
7
91
58
78
46
56
69
92
46
96
36
22
84
4
8
62
64
61
38
91
2
87
46
27
63
35
55
10
7
74
60
73
45
83
94
40
70

output:

3

result:

wrong answer 1st lines differ - expected: '7', found: '3'

Subtask #4:

score: 0
Skipped

Dependency #1:

100%
Accepted

Dependency #2:

0%