QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#432607#2646. Xylophoneegypt_ioi2024b_03100 ✓19ms4400kbC++231.6kb2024-06-07 13:36:222024-06-07 13:36:22

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 11
Accepted

Test #1:

score: 11
Accepted
time: 1ms
memory: 3808kb

input:

2
1

output:

Q 1 2
A 1 1
A 2 2
E 0 0

result:

ok Accepted

Test #2:

score: 0
Accepted
time: 1ms
memory: 3892kb

input:

3
2
1
2

output:

Q 1 3
Q 2 3
A 1 1
Q 1 2
A 2 3
A 3 2
E 0 0

result:

ok Accepted

Test #3:

score: 0
Accepted
time: 1ms
memory: 3772kb

input:

42
40
40
41
41
41
40
16
18
6
22
18
24
15
7
4
11
22
16
9
16
1
17
17
11
23
30
5
30
1
5
21
27
16
12
28
34
30
2
32
5
3
26
4
30
25
6
26
25
10
11
10
16
15
12
34
24
5

output:

Q 21 42
Q 10 42
Q 5 42
Q 7 42
Q 8 42
Q 9 42
A 8 1
Q 8 9
A 9 17
Q 7 8
A 7 19
Q 9 10
Q 8 10
A 10 23
Q 10 11
Q 9 11
A 11 41
Q 11 12
A 12 26
Q 12 13
A 13 33
Q 13 14
Q 12 14
A 14 37
Q 14 15
A 15 15
Q 15 16
A 16 31
Q 16 17
Q 15 17
A 17 22
Q 17 18
A 18 21
Q 18 19
Q 17 19
A 19 38
Q 19 20
A 20 27
Q 20 21
A 2...

result:

ok Accepted

Test #4:

score: 0
Accepted
time: 1ms
memory: 3860kb

input:

98
95
96
97
96
97
97
96
85
15
18
14
32
49
44
41
85
40
27
40
19
46
32
44
5
49
59
67
7
23
24
24
9
24
69
47
27
47
30
2
32
9
11
30
18
48
25
19
25
3
22
23
26
70
18
70
12
30
34
34
45
13
45
1
14
32
33
19
32
23
42
14
23
42
56
29
21
29
9
30
79
40
42
54
24
54
23
24
61
68
28
45
40
48
15
13
15
82
15
6
15
13
19
...

output:

Q 49 98
Q 24 98
Q 12 98
Q 18 98
Q 15 98
Q 16 98
Q 17 98
A 16 1
Q 16 17
A 17 86
Q 15 16
A 15 16
Q 17 18
A 18 68
Q 18 19
Q 17 19
A 19 54
Q 19 20
A 20 5
Q 20 21
A 21 49
Q 21 22
Q 20 22
A 22 90
Q 22 23
A 23 50
Q 23 24
Q 22 24
A 24 77
Q 24 25
Q 23 25
A 25 96
Q 25 26
A 26 64
Q 26 27
A 27 20
Q 27 28
Q 26 2...

result:

ok Accepted

Test #5:

score: 0
Accepted
time: 1ms
memory: 3920kb

input:

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

output:

Q 49 99
Q 74 99
Q 86 99
Q 92 99
Q 95 99
Q 97 99
Q 98 99
A 98 1
A 99 99
Q 97 98
A 97 98
Q 96 97
A 96 2
Q 95 96
A 95 97
Q 94 95
A 94 3
Q 93 94
A 93 96
Q 92 93
A 92 4
Q 91 92
A 91 95
Q 90 91
A 90 5
Q 89 90
A 89 94
Q 88 89
A 88 6
Q 87 88
A 87 93
Q 86 87
A 86 7
Q 85 86
A 85 92
Q 84 85
A 84 8
Q 83 84
A 83...

result:

ok Accepted

Test #6:

score: 0
Accepted
time: 1ms
memory: 3908kb

input:

99
95
96
97
97
97
98
97
52
20
72
1
20
2
2
3
3
5
5
8
8
13
13
21
34
34
55
53
7
60
43
1
44
2
3
5
5
8
8
13
13
33
33
46
29
4
29
50
67
24
67
35
59
11
7
11
4
2
4
1
2
45
55
34
21
13
8
5
3
2
1
62
7
69
4
3
1
9
1
10
2
2
3
5
5
9
9
18
28
5
33
2
7
4
9
20
20
29
14
1
14
4
4
5
11
17
17
28
46
14
60
62
33
27
4
1
4
44
...

output:

Q 49 99
Q 24 99
Q 12 99
Q 6 99
Q 3 99
Q 1 99
Q 2 99
A 1 1
Q 1 2
A 2 53
Q 2 3
Q 1 3
A 3 73
Q 3 4
Q 2 4
A 4 72
Q 4 5
Q 3 5
A 5 74
Q 5 6
Q 4 6
A 6 71
Q 6 7
Q 5 7
A 7 76
Q 7 8
Q 6 8
A 8 68
Q 8 9
Q 7 9
A 9 81
Q 9 10
A 10 60
Q 10 11
Q 9 11
A 11 94
Q 11 12
A 12 39
Q 12 13
A 13 92
Q 13 14
Q 12 14
A 14 99
Q ...

result:

ok Accepted

Test #7:

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

input:

99
95
98
98
98
98
98
95
73
45
16
89
86
19
12
31
1
13
21
22
30
30
49
5
54
65
44
38
44
69
2
69
30
54
72
40
11
40
13
21
34
67
10
54
12
12
28
40
2
42
11
11
10
11
3
10
47
7
54
43
17
43
2
19
64
42
27
69
8
27
32
30
62
10
12
12
4
35
17
35
21
38
86
17
39
45
57
21
72
8
66
6
60
16
60
21
21
4
21
2
64
96
48
26
7...

output:

Q 49 99
Q 24 99
Q 36 99
Q 42 99
Q 45 99
Q 47 99
Q 48 99
A 47 1
Q 47 48
A 48 74
Q 46 47
A 46 46
Q 48 49
Q 47 49
A 49 90
Q 49 50
A 50 4
Q 50 51
A 51 23
Q 51 52
Q 50 52
A 52 35
Q 52 53
Q 51 53
A 53 36
Q 53 54
Q 52 54
A 54 57
Q 54 55
Q 53 55
A 55 27
Q 55 56
A 56 76
Q 56 57
Q 55 57
A 57 81
Q 57 58
A 58 1...

result:

ok Accepted

Test #8:

score: 0
Accepted
time: 1ms
memory: 3908kb

input:

99
98
98
98
98
98
98
1
98
87
5
87
7
12
44
11
44
10
21
51
37
29
66
33
1
34
3
3
19
19
5
19
51
22
51
6
28
24
24
63
20
27
39
39
64
70
81
39
38
77
83
38
42
56
39
64
83
52
28
80
82
61
25
8
25
37
45
53
10
63
4
18
22
87
92
68
60
20
49
58
35
40
50
12
30
30
47
21
19
6
35
45
57
16
57
24
40
8
33
30
51
17
1
15
3...

output:

Q 49 99
Q 74 99
Q 86 99
Q 92 99
Q 95 99
Q 97 99
Q 98 99
A 97 1
Q 97 98
A 98 99
Q 96 97
A 96 88
A 99 98
Q 95 96
Q 95 97
A 95 83
Q 94 95
Q 94 96
A 94 76
Q 93 94
A 93 32
Q 92 93
Q 92 94
A 92 43
Q 91 92
Q 91 93
A 91 53
Q 90 91
A 90 2
Q 89 90
A 89 39
Q 88 89
Q 88 90
A 88 68
Q 87 88
A 87 35
Q 86 87
Q 86 8...

result:

ok Accepted

Test #9:

score: 0
Accepted
time: 1ms
memory: 3816kb

input:

100
50
75
88
94
97
99
98
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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:

Q 50 100
Q 25 100
Q 12 100
Q 6 100
Q 3 100
Q 1 100
Q 2 100
A 1 1
Q 1 2
A 2 2
Q 2 3
A 3 3
Q 3 4
A 4 4
Q 4 5
A 5 5
Q 5 6
A 6 6
Q 6 7
A 7 7
Q 7 8
A 8 8
Q 8 9
A 9 9
Q 9 10
A 10 10
Q 10 11
A 11 11
Q 11 12
A 12 12
Q 12 13
A 13 13
Q 13 14
A 14 14
Q 14 15
A 15 15
Q 15 16
A 16 16
Q 16 17
A 17 17
Q 17 18
A 18...

result:

ok Accepted

Test #10:

score: 0
Accepted
time: 1ms
memory: 3772kb

input:

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

output:

Q 50 100
Q 25 100
Q 12 100
Q 6 100
Q 3 100
Q 1 100
Q 2 100
A 1 1
Q 1 2
A 2 100
Q 2 3
A 3 2
Q 3 4
A 4 99
Q 4 5
A 5 3
Q 5 6
A 6 98
Q 6 7
A 7 4
Q 7 8
A 8 97
Q 8 9
A 9 5
Q 9 10
A 10 96
Q 10 11
A 11 6
Q 11 12
A 12 95
Q 12 13
A 13 7
Q 13 14
A 14 94
Q 14 15
A 15 8
Q 15 16
A 16 93
Q 16 17
A 17 9
Q 17 18
A 1...

result:

ok Accepted

Test #11:

score: 0
Accepted
time: 1ms
memory: 3912kb

input:

100
90
98
98
99
98
99
98
21
13
22
2
24
9
9
36
45
14
35
35
23
12
9
12
3
1
3
15
16
1
15
4
4
5
5
9
9
16
16
29
29
57
86
73
11
8
1
87
70
41
25
41
16
9
7
2
35
8
43
5
3
2
1
95
75
29
24
5
2
5
1
32
2
1
2
29
30
1
30
3
4
4
17
17
22
39
61
42
47
29
18
11
7
4
3
1
64
1
65
2
2
3
3
5
8
8
15
58
59
35
22
13
8
5
3
2
1
...

output:

Q 50 100
Q 25 100
Q 12 100
Q 6 100
Q 9 100
Q 7 100
Q 8 100
A 7 1
Q 7 8
A 8 22
Q 6 7
A 6 14
Q 8 9
A 9 44
Q 9 10
Q 8 10
A 10 46
Q 10 11
Q 9 11
A 11 37
Q 11 12
A 12 73
Q 12 13
A 13 28
Q 13 14
A 14 42
Q 14 15
Q 13 15
A 15 7
Q 15 16
A 16 30
Q 16 17
A 17 18
Q 17 18
Q 16 18
A 18 27
Q 18 19
A 19 24
Q 19 20
...

result:

ok Accepted

Test #12:

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

input:

100
99
97
97
97
99
98
1
73
65
1
66
3
3
31
31
34
34
22
56
11
9
11
1
9
81
1
82
2
2
3
3
6
6
9
9
15
23
39
34
3
34
2
3
1
2
49
85
1
86
2
3
3
5
5
8
8
15
20
1
21
2
2
3
3
5
8
8
13
13
21
34
56
22
1
23
97
2
1
74
2
3
3
5
5
8
8
13
21
21
34
3
42
45
26
16
10
6
3
2
1
42
26
15
9
15
6
3
2
1
39
47
29
18
11
7
4
3
1
3
3...

output:

Q 50 100
Q 75 100
Q 62 100
Q 56 100
Q 53 100
Q 54 100
A 53 1
Q 53 54
A 54 2
Q 52 53
A 52 74
Q 54 55
A 55 67
Q 55 56
Q 54 56
A 56 68
Q 56 57
Q 55 57
A 57 65
Q 57 58
Q 56 58
A 58 96
Q 58 59
A 59 62
Q 59 60
A 60 28
Q 60 61
Q 59 61
A 61 6
Q 61 62
A 62 17
Q 62 63
Q 61 63
A 63 8
Q 63 64
Q 62 64
A 64 9
Q 6...

result:

ok Accepted

Test #13:

score: 0
Accepted
time: 1ms
memory: 3776kb

input:

100
96
97
99
99
99
99
99
54
67
15
54
23
38
50
14
64
9
14
26
35
30
30
66
85
73
19
92
94
54
8
62
21
29
11
2
11
65
1
66
44
30
74
44
11
44
23
1
44
39
12
39
22
34
10
22
9
10
13
68
37
30
67
59
23
52
2
52
6
78
10
88
87
86
41
40
81
62
44
29
84
17
24
14
54
62
32
52
31
10
41
12
22
21
11
7
53
1
17
26
1
51
25
5...

output:

Q 50 100
Q 25 100
Q 12 100
Q 18 100
Q 21 100
Q 23 100
Q 24 100
A 24 1
Q 24 25
A 25 55
Q 23 24
A 23 68
Q 25 26
Q 24 26
A 26 40
Q 26 27
Q 25 27
A 27 17
Q 27 28
A 28 67
Q 28 29
Q 27 29
A 29 81
Q 29 30
Q 28 30
A 30 72
Q 30 31
Q 29 31
A 31 46
Q 31 32
Q 30 32
A 32 76
Q 32 33
A 33 10
Q 33 34
A 34 95
Q 34 3...

result:

ok Accepted

Test #14:

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

input:

100
98
98
99
98
98
98
58
51
28
86
1
28
10
11
5
15
24
29
8
24
44
52
64
4
68
13
17
56
24
80
28
61
21
13
34
42
43
20
43
32
86
7
9
16
58
42
17
42
18
35
69
2
88
54
34
12
34
28
40
58
34
28
62
13
9
31
40
71
87
64
56
4
9
67
79
8
8
54
41
24
64
20
71
17
71
24
3
45
28
7
28
45
70
37
18
2
63
97
77
21
98
75
4
5
4...

output:

Q 50 100
Q 25 100
Q 12 100
Q 18 100
Q 15 100
Q 13 100
A 12 1
Q 12 13
A 13 59
Q 11 12
A 11 52
Q 13 14
Q 12 14
A 14 87
Q 14 15
Q 13 15
A 15 86
Q 15 16
Q 14 16
A 16 76
Q 16 17
Q 15 17
A 17 71
Q 17 18
Q 16 18
A 18 47
Q 18 19
Q 17 19
A 19 55
Q 19 20
Q 18 20
A 20 99
Q 20 21
A 21 35
Q 21 22
Q 20 22
A 22 31...

result:

ok Accepted

Test #15:

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

input:

100
99
93
93
93
94
94
98
24
76
73
90
58
16
58
43
43
60
20
60
43
63
47
28
75
3
31
18
31
49
55
61
59
77
40
31
71
18
61
34
10
34
13
13
26
40
35
40
23
19
42
28
28
1
28
59
33
45
13
58
2
13
4
27
12
39
26
11
21
21
43
4
47
41
3
15
15
32
27
32
15
42
13
28
53
35
53
12
35
20
25
57
55
63
13
3
13
41
6
26
26
23
3...

output:

Q 50 100
Q 75 100
Q 62 100
Q 56 100
Q 53 100
Q 51 100
A 50 1
Q 50 51
A 51 99
Q 49 50
A 49 25
Q 51 52
A 52 23
Q 52 53
A 53 96
Q 53 54
A 54 6
Q 54 55
A 55 64
Q 55 56
Q 54 56
A 56 48
Q 56 57
Q 55 57
A 57 91
Q 57 58
A 58 31
Q 58 59
Q 57 59
A 59 51
Q 59 60
Q 58 60
A 60 94
Q 60 61
A 61 47
Q 61 62
Q 60 62
...

result:

ok Accepted

Subtask #2:

score: 36
Accepted

Dependency #1:

100%
Accepted

Test #16:

score: 36
Accepted
time: 2ms
memory: 3868kb

input:

226
223
224
224
225
225
225
224
224
136
61
64
200
127
149
31
175
6
175
113
67
180
171
168
36
120
113
20
17
37
83
5
83
30
30
72
72
11
83
77
5
77
29
29
43
53
48
53
166
131
32
63
51
114
28
51
4
32
92
18
92
75
102
177
117
36
153
37
37
93
93
219
223
107
91
198
103
18
103
61
61
86
52
86
84
42
157
162
28
2...

output:

Q 113 226
Q 56 226
Q 28 226
Q 14 226
Q 21 226
Q 24 226
Q 26 226
Q 25 226
A 24 1
Q 24 25
A 25 137
Q 23 24
A 23 62
Q 25 26
Q 24 26
A 26 201
Q 26 27
A 27 74
Q 27 28
A 28 223
Q 28 29
A 29 192
Q 29 30
A 30 17
Q 30 31
Q 29 31
A 31 23
Q 31 32
A 32 136
Q 32 33
Q 31 33
A 33 203
Q 33 34
A 34 32
Q 34 35
A 35 2...

result:

ok Accepted

Test #17:

score: 0
Accepted
time: 4ms
memory: 3868kb

input:

479
476
477
478
477
478
477
477
477
34
55
21
13
8
5
3
2
1
387
1
388
173
182
182
168
188
356
116
72
44
28
16
12
4
2
4
1
2
32
32
15
32
35
35
342
328
1
329
2
2
3
3
5
5
8
8
14
14
22
37
37
59
59
96
114
114
431
265
165
265
98
165
65
98
32
65
27
32
2
27
1
2
146
147
374
231
143
88
55
33
22
11
7
11
4
3
1
105...

output:

Q 239 479
Q 119 479
Q 59 479
Q 89 479
Q 74 479
Q 81 479
Q 77 479
Q 75 479
A 74 1
Q 74 75
A 75 35
Q 73 74
A 73 56
Q 75 76
A 76 14
Q 76 77
A 77 27
Q 77 78
A 78 19
Q 78 79
A 79 24
Q 79 80
A 80 21
Q 80 81
A 81 23
Q 81 82
A 82 22
Q 82 83
A 83 409
Q 83 84
Q 82 84
A 84 410
Q 84 85
A 85 237
Q 85 86
Q 84 86
...

result:

ok Accepted

Test #18:

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

input:

821
819
819
819
819
820
819
820
819
819
211
169
162
211
558
45
603
146
146
154
300
164
164
428
468
52
520
98
150
381
3
384
95
98
406
209
174
209
413
560
47
560
368
243
611
680
51
731
189
328
200
328
352
69
421
728
484
358
27
385
681
113
329
22
329
363
363
336
6
342
331
337
56
387
330
137
330
488
228...

output:

Q 410 821
Q 205 821
Q 102 821
Q 51 821
Q 25 821
Q 38 821
Q 31 821
Q 34 821
Q 32 821
A 31 1
Q 31 32
A 32 212
Q 30 31
A 30 170
Q 32 33
Q 31 33
A 33 50
Q 33 34
A 34 608
Q 34 35
Q 33 35
A 35 653
Q 35 36
Q 34 36
A 36 507
Q 36 37
Q 35 37
A 37 353
Q 37 38
Q 36 38
A 38 517
Q 38 39
A 39 89
Q 39 40
A 40 557
Q...

result:

ok Accepted

Test #19:

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

input:

998
995
996
997
996
996
997
997
997
997
996
149
202
415
256
671
18
274
723
605
1
606
605
247
609
674
158
832
748
644
621
859
793
686
644
207
851
261
296
276
572
694
564
254
564
197
254
233
233
276
509
151
427
26
375
78
453
157
235
400
65
465
735
920
889
362
281
362
132
281
118
250
323
6
323
518
310
...

output:

Q 499 998
Q 249 998
Q 124 998
Q 186 998
Q 155 998
Q 139 998
Q 147 998
Q 151 998
Q 153 998
Q 154 998
A 153 1
Q 153 154
A 154 150
Q 152 153
A 152 203
Q 154 155
A 155 565
Q 155 156
Q 154 156
A 156 821
Q 156 157
Q 155 157
A 157 839
Q 157 158
A 158 116
Q 158 159
A 159 721
Q 159 160
Q 158 160
A 160 722
Q ...

result:

ok Accepted

Test #20:

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

input:

999
996
996
998
998
998
998
998
996
996
996
267
432
165
102
63
39
24
15
9
6
3
2
3
1
251
1
252
2
2
6
6
11
11
17
17
28
28
46
46
74
74
123
123
207
207
335
544
882
549
331
880
202
129
73
49
73
21
49
14
21
4
14
1
4
172
173
1
172
502
1
502
3
3
4
4
7
7
11
11
18
32
32
50
50
90
90
140
140
230
230
370
601
743...

output:

Q 499 999
Q 249 999
Q 124 999
Q 186 999
Q 217 999
Q 233 999
Q 241 999
Q 245 999
Q 243 999
Q 242 999
A 241 1
Q 241 242
A 242 268
Q 240 241
A 240 433
Q 242 243
A 243 103
Q 243 244
A 244 205
Q 244 245
A 245 142
Q 245 246
A 246 181
Q 246 247
A 247 157
Q 247 248
A 248 172
Q 248 249
A 249 163
Q 249 250
A ...

result:

ok Accepted

Test #21:

score: 0
Accepted
time: 7ms
memory: 4032kb

input:

999
997
998
998
998
997
998
997
997
998
997
620
195
414
122
414
265
387
382
647
543
411
954
799
42
799
152
152
189
252
441
167
419
169
169
155
169
347
212
559
77
289
138
633
58
691
392
165
557
244
409
478
169
647
96
217
217
140
217
89
140
193
282
929
86
109
109
896
380
302
380
141
443
625
331
956
45...

output:

Q 499 999
Q 249 999
Q 374 999
Q 436 999
Q 467 999
Q 451 999
Q 459 999
Q 455 999
Q 453 999
Q 454 999
A 453 1
Q 453 454
A 454 621
Q 452 453
A 452 196
Q 454 455
A 455 207
Q 455 456
Q 454 456
A 456 329
Q 456 457
Q 455 457
A 457 594
Q 457 458
Q 456 458
A 458 976
Q 458 459
A 459 433
Q 459 460
Q 458 460
A ...

result:

ok Accepted

Test #22:

score: 0
Accepted
time: 8ms
memory: 3976kb

input:

999
997
998
997
997
997
997
998
998
997
998
846
574
717
767
186
141
186
91
141
374
333
374
602
87
689
929
412
47
459
90
137
262
352
71
333
488
420
908
444
525
754
664
403
428
831
397
280
677
111
391
430
389
819
59
74
133
271
22
293
281
281
116
281
571
157
279
436
432
489
318
489
140
318
378
378
652
...

output:

Q 499 999
Q 249 999
Q 374 999
Q 311 999
Q 280 999
Q 264 999
Q 256 999
Q 260 999
Q 262 999
Q 261 999
A 261 1
Q 261 262
A 262 847
Q 260 261
A 260 575
Q 262 263
A 263 130
Q 263 264
A 264 897
Q 264 265
A 265 711
Q 265 266
Q 264 266
A 266 852
Q 266 267
Q 265 267
A 267 761
Q 267 268
A 268 387
Q 268 269
Q ...

result:

ok Accepted

Test #23:

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

input:

1000
500
750
875
938
969
985
993
997
999
998
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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:

Q 500 1000
Q 250 1000
Q 125 1000
Q 62 1000
Q 31 1000
Q 15 1000
Q 7 1000
Q 3 1000
Q 1 1000
Q 2 1000
A 1 1
Q 1 2
A 2 2
Q 2 3
A 3 3
Q 3 4
A 4 4
Q 4 5
A 5 5
Q 5 6
A 6 6
Q 6 7
A 7 7
Q 7 8
A 8 8
Q 8 9
A 9 9
Q 9 10
A 10 10
Q 10 11
A 11 11
Q 11 12
A 12 12
Q 12 13
A 13 13
Q 13 14
A 14 14
Q 14 15
A 15 15
Q 15...

result:

ok Accepted

Test #24:

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

input:

1000
999
999
999
999
999
999
999
999
999
999
998
997
996
995
994
993
992
991
990
989
988
987
986
985
984
983
982
981
980
979
978
977
976
975
974
973
972
971
970
969
968
967
966
965
964
963
962
961
960
959
958
957
956
955
954
953
952
951
950
949
948
947
946
945
944
943
942
941
940
939
938
937
936
935...

output:

Q 500 1000
Q 750 1000
Q 875 1000
Q 937 1000
Q 968 1000
Q 984 1000
Q 992 1000
Q 996 1000
Q 998 1000
Q 999 1000
A 999 1
A 1000 1000
Q 998 999
A 998 999
Q 997 998
A 997 2
Q 996 997
A 996 998
Q 995 996
A 995 3
Q 994 995
A 994 997
Q 993 994
A 993 4
Q 992 993
A 992 996
Q 991 992
A 991 5
Q 990 991
A 990 99...

result:

ok Accepted

Test #25:

score: 0
Accepted
time: 4ms
memory: 3972kb

input:

1000
500
750
875
938
969
985
993
997
999
998
999
998
997
996
995
994
993
992
991
990
989
988
987
986
985
984
983
982
981
980
979
978
977
976
975
974
973
972
971
970
969
968
967
966
965
964
963
962
961
960
959
958
957
956
955
954
953
952
951
950
949
948
947
946
945
944
943
942
941
940
939
938
937
936...

output:

Q 500 1000
Q 250 1000
Q 125 1000
Q 62 1000
Q 31 1000
Q 15 1000
Q 7 1000
Q 3 1000
Q 1 1000
Q 2 1000
A 1 1
Q 1 2
A 2 1000
Q 2 3
A 3 2
Q 3 4
A 4 999
Q 4 5
A 5 3
Q 5 6
A 6 998
Q 6 7
A 7 4
Q 7 8
A 8 997
Q 8 9
A 9 5
Q 9 10
A 10 996
Q 10 11
A 11 6
Q 11 12
A 12 995
Q 12 13
A 13 7
Q 13 14
A 14 994
Q 14 15
A ...

result:

ok Accepted

Test #26:

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

input:

1000
997
999
998
999
999
999
999
998
999
999
211
379
83
211
20
83
13
20
5
13
1
5
808
1
809
2
2
3
3
5
5
8
8
13
13
21
21
35
35
65
65
100
648
1
648
3
3
6
6
11
11
19
19
30
30
49
49
82
82
132
132
245
245
379
250
629
706
461
237
461
132
237
88
132
43
88
36
43
6
36
3
6
217
220
1
217
2
2
3
3
5
5
8
8
13
13
2...

output:

Q 500 1000
Q 250 1000
Q 375 1000
Q 312 1000
Q 343 1000
Q 359 1000
Q 367 1000
Q 371 1000
Q 369 1000
Q 370 1000
A 370 1
Q 370 371
A 371 212
Q 369 370
A 369 380
Q 371 372
Q 370 372
A 372 129
Q 372 373
Q 371 373
A 373 149
Q 373 374
Q 372 374
A 374 136
Q 374 375
Q 373 375
A 375 141
Q 375 376
Q 374 376
A ...

result:

ok Accepted

Test #27:

score: 0
Accepted
time: 4ms
memory: 3952kb

input:

1000
999
995
997
999
999
999
997
999
999
997
11
21
8
11
3
1
3
15
16
16
9
6
9
3
2
3
1
990
657
458
315
131
315
101
131
30
22
30
6
22
5
6
1
407
408
52
459
25
17
25
7
17
5
7
2
284
492
296
172
296
122
172
50
5
50
300
300
881
456
376
456
45
376
23
45
4
23
1
4
561
150
711
105
150
40
105
37
40
1
37
238
238
...

output:

Q 500 1000
Q 750 1000
Q 625 1000
Q 562 1000
Q 593 1000
Q 609 1000
Q 617 1000
Q 613 1000
Q 615 1000
Q 616 1000
A 615 1
Q 615 616
A 616 12
Q 614 615
A 614 22
Q 616 617
Q 615 617
A 617 4
Q 617 618
A 618 7
Q 618 619
Q 617 619
A 619 6
Q 619 620
A 620 21
Q 620 621
Q 619 621
A 621 5
Q 621 622
A 622 14
Q 62...

result:

ok Accepted

Test #28:

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

input:

1000
993
996
999
998
999
998
998
999
998
999
321
562
427
57
427
40
97
342
382
372
208
372
249
457
433
627
920
16
936
235
140
375
453
131
453
202
333
229
229
71
229
113
184
109
113
553
78
631
671
597
609
145
609
116
145
143
259
439
21
439
40
61
154
194
255
255
359
614
823
26
823
95
95
47
142
802
84
8...

output:

Q 500 1000
Q 250 1000
Q 125 1000
Q 187 1000
Q 156 1000
Q 171 1000
Q 163 1000
Q 159 1000
Q 161 1000
Q 160 1000
A 160 1
Q 160 161
A 161 322
Q 159 160
A 159 563
Q 161 162
A 162 749
Q 162 163
Q 161 163
A 163 692
Q 163 164
Q 162 164
A 164 652
Q 164 165
Q 163 165
A 165 310
Q 165 166
A 166 682
Q 166 167
Q ...

result:

ok Accepted

Test #29:

score: 0
Accepted
time: 8ms
memory: 3856kb

input:

1000
996
998
999
998
999
999
998
999
998
998
792
885
125
917
867
293
246
539
380
626
743
264
227
264
58
227
76
76
323
1
323
562
675
437
16
437
265
398
663
12
398
767
747
137
320
320
684
154
684
558
798
38
836
36
201
84
285
189
189
109
189
230
339
424
424
390
284
390
804
526
31
526
177
208
322
322
56...

output:

Q 500 1000
Q 250 1000
Q 125 1000
Q 187 1000
Q 156 1000
Q 171 1000
Q 179 1000
Q 175 1000
Q 177 1000
Q 176 1000
A 175 1
Q 175 176
A 176 793
Q 174 175
A 174 886
Q 176 177
Q 175 177
A 177 918
Q 177 178
A 178 51
Q 178 179
A 179 344
Q 179 180
Q 178 180
A 180 590
Q 180 181
Q 179 181
A 181 970
Q 181 182
A 1...

result:

ok Accepted

Test #30:

score: 0
Accepted
time: 8ms
memory: 4000kb

input:

1000
998
999
998
998
998
998
998
998
998
801
859
5
801
8
13
685
768
735
340
342
682
2
342
102
102
714
252
446
446
144
244
517
731
482
348
571
11
571
66
77
574
111
574
106
217
136
242
81
136
130
211
172
172
252
424
604
614
781
147
725
566
211
777
546
323
546
484
217
597
56
7
56
341
281
341
745
75
745...

output:

Q 500 1000
Q 250 1000
Q 375 1000
Q 312 1000
Q 281 1000
Q 265 1000
Q 257 1000
Q 253 1000
Q 251 1000
A 250 1
Q 250 251
A 251 802
Q 249 250
A 249 860
Q 251 252
Q 250 252
A 252 797
Q 252 253
Q 251 253
A 253 789
Q 253 254
A 254 104
Q 254 255
A 255 872
Q 255 256
A 256 137
Q 256 257
A 257 477
Q 257 258
Q 2...

result:

ok Accepted

Subtask #3:

score: 53
Accepted

Dependency #1:

100%
Accepted

Dependency #2:

100%
Accepted

Test #31:

score: 53
Accepted
time: 0ms
memory: 4012kb

input:

2164
2159
2163
2161
2161
2163
2163
2163
2161
2161
2163
2161
613
2015
309
922
766
766
134
900
198
1064
64
1064
176
240
254
430
356
356
582
938
252
582
874
455
874
1004
1004
913
40
953
494
494
1369
1188
757
984
113
984
232
232
1248
753
693
1446
1047
180
1047
622
622
200
622
249
449
678
678
984
843
182...

output:

Q 1082 2164
Q 541 2164
Q 811 2164
Q 676 2164
Q 608 2164
Q 642 2164
Q 659 2164
Q 667 2164
Q 663 2164
Q 661 2164
Q 662 2164
A 661 1
Q 661 662
A 662 614
Q 660 661
A 660 2016
Q 662 663
Q 661 663
A 663 923
Q 663 664
Q 662 664
A 664 157
Q 664 665
Q 663 665
A 665 23
Q 665 666
A 666 221
Q 666 667
A 667 1285...

result:

ok Accepted

Test #32:

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

input:

3087
3084
3086
3084
3086
3086
3086
3086
3084
3084
3084
3086
3086
34
2186
2319
2012
772
191
772
126
317
586
586
716
716
545
1261
345
2539
251
98
349
93
98
218
311
2411
992
1079
2071
2619
303
2155
1804
563
1804
1155
1718
446
1155
663
663
1557
805
1557
1157
1157
1598
1720
2184
446
484
484
1060
184
1244...

output:

Q 1543 3087
Q 771 3087
Q 1157 3087
Q 964 3087
Q 1060 3087
Q 1108 3087
Q 1132 3087
Q 1144 3087
Q 1138 3087
Q 1135 3087
Q 1133 3087
Q 1134 3087
A 1134 1
Q 1134 1135
A 1135 35
Q 1133 1134
A 1133 2187
Q 1135 1136
A 1136 2354
Q 1136 1137
A 1137 342
Q 1137 1138
A 1138 1114
Q 1138 1139
Q 1137 1139
A 1139 9...

result:

ok Accepted

Test #33:

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

input:

4354
4349
4353
4353
4349
4349
4349
4353
4349
4349
4349
4353
4349
1690
1807
1236
1690
6
1236
612
1993
2877
2224
298
2224
616
616
805
805
1565
2370
932
285
1217
386
386
486
486
1034
1520
2442
1737
1614
3351
1414
31
1414
1827
1827
2131
858
2131
917
917
1327
1327
2858
3868
1357
1305
2662
1788
664
2452
2...

output:

Q 2177 4354
Q 1088 4354
Q 1632 4354
Q 1904 4354
Q 1768 4354
Q 1700 4354
Q 1666 4354
Q 1683 4354
Q 1674 4354
Q 1670 4354
Q 1668 4354
Q 1669 4354
A 1668 1
Q 1668 1669
A 1669 1691
Q 1667 1668
A 1667 1808
Q 1669 1670
Q 1668 1670
A 1670 455
Q 1670 1671
Q 1669 1671
A 1671 461
Q 1671 1672
A 1672 1073
Q 167...

result:

ok Accepted

Test #34:

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

input:

4997
4996
4995
4995
4995
4995
4995
4995
4995
4995
4996
4996
4996
4995
3747
4671
49
3747
1008
1057
1617
1617
3048
357
3405
1010
923
1010
85
923
152
152
384
384
2880
3692
1919
110
1919
2068
2068
2009
1161
2009
2941
2583
719
2583
1990
1990
549
1990
42
591
159
201
351
351
3648
209
3857
475
439
914
1374
...

output:

Q 2498 4997
Q 3747 4997
Q 3122 4997
Q 2810 4997
Q 2654 4997
Q 2576 4997
Q 2537 4997
Q 2517 4997
Q 2507 4997
Q 2502 4997
Q 2504 4997
Q 2505 4997
Q 2506 4997
A 2505 1
Q 2505 2506
A 2506 3748
Q 2504 2505
A 2504 4672
Q 2506 2507
Q 2505 2507
A 2507 3699
Q 2507 2508
Q 2506 2508
A 2508 2691
Q 2508 2509
Q 2...

result:

ok Accepted

Test #35:

score: 0
Accepted
time: 19ms
memory: 4236kb

input:

4998
4995
4997
4997
4997
4997
4995
4997
4997
4995
4997
4997
4997
4997
3989
2072
1150
1598
1598
3087
1900
673
1900
1214
1214
1747
1965
3712
1190
1027
2217
887
1027
1983
529
2512
3764
4663
3328
1638
1702
1702
2799
1559
324
1883
958
958
1202
1202
2864
3185
1951
1292
1708
3000
3306
3453
459
3912
113
572...

output:

Q 2499 4998
Q 1249 4998
Q 1874 4998
Q 2186 4998
Q 2342 4998
Q 2420 4998
Q 2381 4998
Q 2400 4998
Q 2410 4998
Q 2405 4998
Q 2407 4998
Q 2408 4998
Q 2409 4998
A 2409 1
Q 2409 2410
A 2410 3990
Q 2408 2409
A 2408 2073
Q 2410 2411
A 2411 2840
Q 2411 2412
Q 2410 2412
A 2412 4438
Q 2412 2413
A 2413 1351
Q 2...

result:

ok Accepted

Test #36:

score: 0
Accepted
time: 8ms
memory: 4288kb

input:

4999
2500
3750
4375
4687
4843
4921
4960
4980
4990
4995
4997
4998
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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:

Q 2499 4999
Q 1249 4999
Q 624 4999
Q 312 4999
Q 156 4999
Q 78 4999
Q 39 4999
Q 19 4999
Q 9 4999
Q 4 4999
Q 2 4999
Q 1 4999
A 1 1
Q 1 2
A 2 2
Q 2 3
A 3 3
Q 3 4
A 4 4
Q 4 5
A 5 5
Q 5 6
A 6 6
Q 6 7
A 7 7
Q 7 8
A 8 8
Q 8 9
A 9 9
Q 9 10
A 10 10
Q 10 11
A 11 11
Q 11 12
A 12 12
Q 12 13
A 13 13
Q 13 14
A 14...

result:

ok Accepted

Test #37:

score: 0
Accepted
time: 6ms
memory: 4160kb

input:

4999
4998
4998
4998
4998
4998
4998
4998
4998
4998
4998
4998
4998
4998
4997
4996
4995
4994
4993
4992
4991
4990
4989
4988
4987
4986
4985
4984
4983
4982
4981
4980
4979
4978
4977
4976
4975
4974
4973
4972
4971
4970
4969
4968
4967
4966
4965
4964
4963
4962
4961
4960
4959
4958
4957
4956
4955
4954
4953
4952
...

output:

Q 2499 4999
Q 3749 4999
Q 4374 4999
Q 4686 4999
Q 4842 4999
Q 4920 4999
Q 4959 4999
Q 4979 4999
Q 4989 4999
Q 4994 4999
Q 4996 4999
Q 4997 4999
Q 4998 4999
A 4998 1
A 4999 4999
Q 4997 4998
A 4997 4998
Q 4996 4997
A 4996 2
Q 4995 4996
A 4995 4997
Q 4994 4995
A 4994 3
Q 4993 4994
A 4993 4996
Q 4992 49...

result:

ok Accepted

Test #38:

score: 0
Accepted
time: 6ms
memory: 4288kb

input:

4999
2500
3750
4375
4687
4843
4921
4960
4980
4990
4995
4997
4998
4998
4997
4996
4995
4994
4993
4992
4991
4990
4989
4988
4987
4986
4985
4984
4983
4982
4981
4980
4979
4978
4977
4976
4975
4974
4973
4972
4971
4970
4969
4968
4967
4966
4965
4964
4963
4962
4961
4960
4959
4958
4957
4956
4955
4954
4953
4952
...

output:

Q 2499 4999
Q 1249 4999
Q 624 4999
Q 312 4999
Q 156 4999
Q 78 4999
Q 39 4999
Q 19 4999
Q 9 4999
Q 4 4999
Q 2 4999
Q 1 4999
A 1 1
Q 1 2
A 2 4999
Q 2 3
A 3 2
Q 3 4
A 4 4998
Q 4 5
A 5 3
Q 5 6
A 6 4997
Q 6 7
A 7 4
Q 7 8
A 8 4996
Q 8 9
A 9 5
Q 9 10
A 10 4995
Q 10 11
A 11 6
Q 11 12
A 12 4994
Q 12 13
A 13 ...

result:

ok Accepted

Test #39:

score: 0
Accepted
time: 5ms
memory: 4260kb

input:

4999
4997
4998
4998
4997
4997
4998
4997
4998
4998
4998
4997
4998
430
695
265
165
98
165
65
98
31
65
21
31
10
7
10
3
2
3
1
3058
2245
1395
846
1395
537
846
306
537
210
306
95
210
75
95
14
75
10
14
4
3
4
1
796
797
1080
1876
668
407
668
256
407
150
256
90
150
55
33
55
22
11
7
11
4
1
4
2624
1
2625
3
3
5
...

output:

Q 2499 4999
Q 1249 4999
Q 1874 4999
Q 2186 4999
Q 2030 4999
Q 1952 4999
Q 1991 4999
Q 1971 4999
Q 1981 4999
Q 1986 4999
Q 1988 4999
Q 1987 4999
A 1987 1
Q 1987 1988
A 1988 431
Q 1986 1987
A 1986 696
Q 1988 1989
A 1989 166
Q 1989 1990
A 1990 331
Q 1990 1991
Q 1989 1991
A 1991 233
Q 1991 1992
Q 1990 1...

result:

ok Accepted

Test #40:

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

input:

4999
4992
4997
4997
4998
4998
4998
4997
4998
4998
4998
4998
4997
3085
3972
621
3085
458
1079
1117
1117
1621
2738
2689
2813
1110
375
1485
4
375
2175
2253
2682
174
2856
1454
2018
2018
2475
851
2475
1681
1632
1681
1604
1632
1468
1604
789
1468
2208
2208
3377
682
4059
3472
482
3472
390
872
492
882
1058
1...

output:

Q 2499 4999
Q 1249 4999
Q 624 4999
Q 312 4999
Q 468 4999
Q 546 4999
Q 585 4999
Q 565 4999
Q 575 4999
Q 580 4999
Q 582 4999
Q 583 4999
A 582 1
Q 582 583
A 583 3086
Q 581 582
A 581 3973
Q 583 584
Q 582 584
A 584 2465
Q 584 585
Q 583 585
A 585 2007
Q 585 586
Q 584 586
A 586 3124
Q 586 587
Q 585 587
A 5...

result:

ok Accepted

Test #41:

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

input:

4999
4997
4998
4997
4997
4998
4998
4998
4997
4997
4998
4997
4997
2211
4749
833
2211
1536
1051
1536
2422
3299
2231
1591
3822
2299
539
2838
1223
1223
427
1223
1133
1560
1103
1133
668
1103
632
1300
3545
4250
1421
579
1421
40
579
211
211
337
337
952
1289
2535
2536
797
2536
772
797
1292
2064
2022
665
202...

output:

Q 2499 4999
Q 1249 4999
Q 1874 4999
Q 1561 4999
Q 1405 4999
Q 1483 4999
Q 1522 4999
Q 1541 4999
Q 1531 4999
Q 1526 4999
Q 1528 4999
Q 1527 4999
A 1526 1
Q 1526 1527
A 1527 2212
Q 1525 1526
A 1525 4750
Q 1527 1528
Q 1526 1528
A 1528 1379
Q 1528 1529
A 1529 2915
Q 1529 1530
Q 1528 1530
A 1530 1864
Q 1...

result:

ok Accepted

Test #42:

score: 0
Accepted
time: 9ms
memory: 4168kb

input:

5000
2500
3750
4375
4688
4844
4922
4961
4981
4991
4996
4998
4999
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
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:

Q 2500 5000
Q 1250 5000
Q 625 5000
Q 312 5000
Q 156 5000
Q 78 5000
Q 39 5000
Q 19 5000
Q 9 5000
Q 4 5000
Q 2 5000
Q 1 5000
A 1 1
Q 1 2
A 2 2
Q 2 3
A 3 3
Q 3 4
A 4 4
Q 4 5
A 5 5
Q 5 6
A 6 6
Q 6 7
A 7 7
Q 7 8
A 8 8
Q 8 9
A 9 9
Q 9 10
A 10 10
Q 10 11
A 11 11
Q 11 12
A 12 12
Q 12 13
A 13 13
Q 13 14
A 14...

result:

ok Accepted

Test #43:

score: 0
Accepted
time: 8ms
memory: 4248kb

input:

5000
4999
4999
4999
4999
4999
4999
4999
4999
4999
4999
4999
4999
4999
4998
4997
4996
4995
4994
4993
4992
4991
4990
4989
4988
4987
4986
4985
4984
4983
4982
4981
4980
4979
4978
4977
4976
4975
4974
4973
4972
4971
4970
4969
4968
4967
4966
4965
4964
4963
4962
4961
4960
4959
4958
4957
4956
4955
4954
4953
...

output:

Q 2500 5000
Q 3750 5000
Q 4375 5000
Q 4687 5000
Q 4843 5000
Q 4921 5000
Q 4960 5000
Q 4980 5000
Q 4990 5000
Q 4995 5000
Q 4997 5000
Q 4998 5000
Q 4999 5000
A 4999 1
A 5000 5000
Q 4998 4999
A 4998 4999
Q 4997 4998
A 4997 2
Q 4996 4997
A 4996 4998
Q 4995 4996
A 4995 3
Q 4994 4995
A 4994 4997
Q 4993 49...

result:

ok Accepted

Test #44:

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

input:

5000
2500
3750
4375
4688
4844
4922
4961
4981
4991
4996
4998
4999
4999
4998
4997
4996
4995
4994
4993
4992
4991
4990
4989
4988
4987
4986
4985
4984
4983
4982
4981
4980
4979
4978
4977
4976
4975
4974
4973
4972
4971
4970
4969
4968
4967
4966
4965
4964
4963
4962
4961
4960
4959
4958
4957
4956
4955
4954
4953
...

output:

Q 2500 5000
Q 1250 5000
Q 625 5000
Q 312 5000
Q 156 5000
Q 78 5000
Q 39 5000
Q 19 5000
Q 9 5000
Q 4 5000
Q 2 5000
Q 1 5000
A 1 1
Q 1 2
A 2 5000
Q 2 3
A 3 2
Q 3 4
A 4 4999
Q 4 5
A 5 3
Q 5 6
A 6 4998
Q 6 7
A 7 4
Q 7 8
A 8 4997
Q 8 9
A 9 5
Q 9 10
A 10 4996
Q 10 11
A 11 6
Q 11 12
A 12 4995
Q 12 13
A 13 ...

result:

ok Accepted

Test #45:

score: 0
Accepted
time: 18ms
memory: 4400kb

input:

5000
4995
4995
4998
4998
4999
4999
4999
4998
4998
4998
4998
4999
3807
4
987
4794
610
377
233
144
89
55
34
21
13
8
5
3
2
1
297
298
1
297
2
2
3
3
5
5
8
8
13
13
21
21
34
34
55
55
89
89
144
144
235
235
380
309
380
1
310
3
3
5
5
9
9
14
25
25
72
72
101
101
206
206
310
3362
1144
4506
706
438
267
438
162
26...

output:

Q 2500 5000
Q 1250 5000
Q 625 5000
Q 312 5000
Q 156 5000
Q 234 5000
Q 273 5000
Q 292 5000
Q 282 5000
Q 277 5000
Q 275 5000
Q 274 5000
A 274 1
Q 274 275
A 275 3808
Q 273 274
A 273 5
Q 275 276
Q 274 276
A 276 4795
Q 276 277
A 277 4185
Q 277 278
A 278 4562
Q 278 279
A 279 4329
Q 279 280
A 280 4473
Q 28...

result:

ok Accepted

Test #46:

score: 0
Accepted
time: 7ms
memory: 4356kb

input:

5000
4998
4998
4998
4999
4999
4999
4999
4998
4999
4999
4998
4998
488
799
301
488
185
301
116
69
47
22
14
22
8
6
2
1
2
2329
2166
4495
1314
811
1314
502
811
309
193
114
193
73
114
40
73
33
2
33
1
2
1009
1009
1
1009
2
2
3
3
6
6
10
10
16
16
27
27
47
47
74
3143
2592
1599
956
1599
569
956
387
173
387
113
...

output:

Q 2500 5000
Q 1250 5000
Q 625 5000
Q 312 5000
Q 468 5000
Q 546 5000
Q 585 5000
Q 605 5000
Q 595 5000
Q 600 5000
Q 602 5000
Q 601 5000
A 600 1
Q 600 601
A 601 489
Q 599 600
A 599 800
Q 601 602
Q 600 602
A 602 188
Q 602 603
Q 601 603
A 603 373
Q 603 604
A 604 257
Q 604 605
A 605 326
Q 605 606
A 606 27...

result:

ok Accepted

Test #47:

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

input:

5000
4997
4997
4998
4998
4998
4998
4998
4998
4999
4998
4999
4999
4998
2684
4352
1658
2684
1019
1658
630
1019
389
241
146
241
88
146
58
30
28
2
1
2
3027
1
3028
4
4
5
5
10
10
15
15
31
31
46
46
81
81
132
132
213
213
364
364
584
2878
2605
1610
994
1610
616
378
234
378
144
89
144
55
34
21
13
8
5
3
2
1
89...

output:

Q 2500 5000
Q 1250 5000
Q 625 5000
Q 312 5000
Q 156 5000
Q 78 5000
Q 39 5000
Q 19 5000
Q 9 5000
Q 14 5000
Q 11 5000
Q 12 5000
Q 13 5000
A 12 1
Q 12 13
A 13 2685
Q 11 12
A 11 4353
Q 13 14
Q 12 14
A 14 1027
Q 14 15
Q 13 15
A 15 2046
Q 15 16
Q 14 16
A 16 1416
Q 16 17
A 17 1805
Q 17 18
A 18 1564
Q 18 19...

result:

ok Accepted

Test #48:

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

input:

5000
4981
4993
4993
4999
4999
4993
4999
4999
4993
4999
4993
4999
1855
1144
385
1855
1
386
10
10
56
56
89
89
168
168
401
401
594
594
1013
1013
1817
1817
2910
1370
2910
2
1372
6
6
12
12
18
18
30
30
53
53
141
141
201
201
401
401
602
602
1005
1005
1611
2634
4247
3039
1
3040
2
2
4
4
6
6
12
12
18
18
30
30...

output:

Q 2500 5000
Q 1250 5000
Q 625 5000
Q 312 5000
Q 468 5000
Q 546 5000
Q 507 5000
Q 526 5000
Q 536 5000
Q 531 5000
Q 533 5000
Q 532 5000
A 532 1
Q 532 533
A 533 1856
Q 531 532
A 531 1145
Q 533 534
Q 532 534
A 534 1471
Q 534 535
Q 533 535
A 535 1470
Q 535 536
Q 534 536
A 536 1480
Q 536 537
Q 535 537
A 5...

result:

ok Accepted

Test #49:

score: 0
Accepted
time: 4ms
memory: 4288kb

input:

5000
4997
4999
4999
4999
4999
4999
4997
4997
4999
4997
4999
4999
4999
144
89
3571
3125
1933
1192
741
451
277
451
174
103
63
103
39
63
24
15
8
15
5
8
3
2
1
1501
1501
1
1502
2
2
3
3
5
5
9
9
14
14
24
24
38
38
62
62
100
100
162
162
262
262
424
424
688
688
1113
1113
1801
580
1801
1666
2246
883
534
883
34...

output:

Q 2500 5000
Q 1250 5000
Q 1875 5000
Q 2187 5000
Q 2343 5000
Q 2421 5000
Q 2460 5000
Q 2440 5000
Q 2430 5000
Q 2435 5000
Q 2432 5000
Q 2433 5000
Q 2434 5000
A 2434 1
Q 2434 2435
A 2435 145
Q 2433 2434
A 2433 90
Q 2435 2436
A 2436 3716
Q 2436 2437
A 2437 591
Q 2437 2438
A 2438 2524
Q 2438 2439
A 2439 ...

result:

ok Accepted

Test #50:

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

input:

5000
4999
4975
4992
4992
4995
4995
4999
4999
4995
4999
4999
4999
4999
5
3
2349
1938
2349
1207
731
453
731
278
172
278
106
65
106
40
65
25
15
8
15
4
8
3
4
1
2234
1398
3632
794
466
794
265
466
190
265
63
190
35
63
18
35
14
18
4
3
4
1
511
511
2
511
10
10
12
12
55
55
67
67
124
124
244
48
244
1
49
2
2
7
...

output:

Q 2500 5000
Q 3750 5000
Q 3125 5000
Q 2812 5000
Q 2656 5000
Q 2578 5000
Q 2539 5000
Q 2558 5000
Q 2568 5000
Q 2563 5000
Q 2565 5000
Q 2566 5000
Q 2567 5000
A 2567 1
Q 2567 2568
A 2568 6
Q 2566 2567
A 2566 4
Q 2568 2569
A 2569 2355
Q 2569 2570
Q 2568 2570
A 2570 417
Q 2570 2571
A 2571 1624
Q 2571 257...

result:

ok Accepted

Test #51:

score: 0
Accepted
time: 9ms
memory: 4160kb

input:

5000
4998
4998
4998
4998
4998
4998
4999
4998
4998
4999
4998
4999
2775
226
1332
4107
3944
489
589
1078
987
1576
1957
2944
3364
2818
1721
1510
3231
2921
401
3322
1459
501
1960
1300
1300
1861
1861
275
1861
870
1145
2541
552
2367
1570
3937
1538
368
1538
3013
4491
2484
1712
2484
641
1712
3449
3662
768
44...

output:

Q 2500 5000
Q 1250 5000
Q 625 5000
Q 312 5000
Q 156 5000
Q 78 5000
Q 39 5000
Q 58 5000
Q 48 5000
Q 43 5000
Q 45 5000
Q 44 5000
A 44 1
Q 44 45
A 45 2776
Q 43 44
A 43 227
Q 45 46
Q 44 46
A 46 4108
Q 46 47
A 47 164
Q 47 48
A 48 653
Q 48 49
Q 47 49
A 49 1242
Q 49 50
Q 48 50
A 50 2229
Q 50 51
Q 49 51
A 5...

result:

ok Accepted

Test #52:

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

input:

5000
4999
4995
4999
4995
4995
4999
4999
4995
4999
4999
4999
4999
4999
2694
2308
71
2765
2160
2231
534
46
534
4165
1884
260
1884
610
870
79
610
2251
1039
2251
2072
2072
329
2072
1702
1618
1702
3308
565
3308
1289
1854
2601
667
2750
383
2750
292
383
69
361
1444
1576
3020
481
1576
258
739
370
628
1074
1...

output:

Q 2500 5000
Q 3750 5000
Q 3125 5000
Q 3437 5000
Q 3281 5000
Q 3203 5000
Q 3242 5000
Q 3261 5000
Q 3251 5000
Q 3256 5000
Q 3258 5000
Q 3259 5000
Q 3260 5000
A 3260 1
Q 3260 3261
A 3261 2695
Q 3259 3260
A 3259 2309
Q 3261 3262
Q 3260 3262
A 3262 2766
Q 3262 3263
Q 3261 3263
A 3263 4926
Q 3263 3264
A 3...

result:

ok Accepted

Test #53:

score: 0
Accepted
time: 11ms
memory: 4324kb

input:

5000
4997
4999
4997
4999
4999
4997
4997
4997
4999
4999
4999
4999
4999
4358
2617
473
4358
469
473
3000
467
3000
1762
2229
10
1772
2663
1404
1079
2483
999
2078
1489
124
1613
802
926
1319
1319
1166
1319
1908
1908
1769
85
1769
2317
2317
1228
1068
2296
567
1635
103
567
1183
1183
3494
3568
2960
2751
966
2...

output:

Q 2500 5000
Q 1250 5000
Q 1875 5000
Q 1562 5000
Q 1718 5000
Q 1796 5000
Q 1757 5000
Q 1737 5000
Q 1727 5000
Q 1732 5000
Q 1734 5000
Q 1735 5000
Q 1736 5000
A 1736 1
Q 1736 1737
A 1737 4359
Q 1735 1736
A 1735 2618
Q 1737 1738
Q 1736 1738
A 1738 3886
Q 1738 1739
Q 1737 1739
A 1739 4355
Q 1739 1740
A 1...

result:

ok Accepted

Test #54:

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

input:

5000
4995
4995
4999
4996
4997
4997
4997
4999
4999
4999
4997
4997
4388
3810
166
4554
284
284
2710
1806
1745
134
1745
484
484
3669
2645
2033
4678
3155
743
3155
861
861
189
1050
220
220
1001
1001
1497
1778
3275
1111
1778
1608
1608
2306
1913
2306
691
1913
1670
2361
1206
2876
671
1333
800
2133
2120
156
2...

output:

Q 2500 5000
Q 1250 5000
Q 625 5000
Q 937 5000
Q 781 5000
Q 703 5000
Q 664 5000
Q 644 5000
Q 654 5000
Q 659 5000
Q 661 5000
Q 660 5000
A 659 1
Q 659 660
A 660 4389
Q 658 659
A 658 3811
Q 660 661
Q 659 661
A 661 4555
Q 661 662
Q 660 662
A 662 4271
Q 662 663
A 663 1561
Q 663 664
A 664 3367
Q 664 665
A ...

result:

ok Accepted

Test #55:

score: 0
Accepted
time: 14ms
memory: 4184kb

input:

5000
4996
4996
4998
4999
4998
4998
4998
4999
4998
4998
4999
4999
4999
820
4848
2669
824
3493
3842
4090
501
3603
4358
2170
2309
4479
3921
687
3921
301
988
561
862
2024
2585
906
992
1898
187
992
916
916
711
1627
338
711
1266
1604
1702
2968
637
1702
603
1240
356
603
1507
1863
1871
310
2181
691
691
650
...

output:

Q 2500 5000
Q 1250 5000
Q 625 5000
Q 312 5000
Q 468 5000
Q 390 5000
Q 351 5000
Q 331 5000
Q 341 5000
Q 336 5000
Q 333 5000
Q 334 5000
Q 335 5000
A 335 1
Q 335 336
A 336 821
Q 334 335
A 334 4849
Q 336 337
A 337 3490
Q 337 338
Q 336 338
A 338 4314
Q 338 339
A 339 472
Q 339 340
A 340 4562
Q 340 341
A 3...

result:

ok Accepted

Test #56:

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

input:

5000
4995
4999
4995
4996
4998
4998
4999
4999
4999
4998
4998
4998
416
2752
1684
1433
1684
1673
1032
2705
1558
2590
2835
265
3100
2191
2109
128
2237
733
733
1146
1146
1532
1741
1741
819
2560
998
2957
1359
2919
1935
2504
3888
4058
233
4058
4137
1072
1106
2178
1038
1106
1314
1314
1169
1314
2316
1641
458...

output:

Q 2500 5000
Q 1250 5000
Q 1875 5000
Q 1562 5000
Q 1406 5000
Q 1328 5000
Q 1289 5000
Q 1308 5000
Q 1318 5000
Q 1323 5000
Q 1320 5000
Q 1319 5000
A 1318 1
Q 1318 1319
A 1319 417
Q 1317 1318
A 1317 2753
Q 1319 1320
A 1320 2101
Q 1320 1321
Q 1319 1321
A 1321 668
Q 1321 1322
A 1322 2341
Q 1322 1323
Q 132...

result:

ok Accepted

Test #57:

score: 0
Accepted
time: 10ms
memory: 4336kb

input:

5000
4993
4998
4999
4999
4998
4998
4998
4998
4998
4998
4998
4999
4114
3125
253
4367
1784
193
1977
2380
2573
632
3954
2309
1237
3546
259
1237
1047
1306
2538
3855
761
4616
3477
3041
1386
1035
2421
2399
2013
1019
2013
316
1335
1101
1101
21
1122
2243
2264
3257
237
3257
567
567
1223
1812
1812
2707
1741
8...

output:

Q 2500 5000
Q 1250 5000
Q 625 5000
Q 937 5000
Q 1093 5000
Q 1015 5000
Q 976 5000
Q 956 5000
Q 946 5000
Q 941 5000
Q 939 5000
Q 938 5000
A 938 1
Q 938 939
A 939 4115
Q 937 938
A 937 3126
Q 939 940
Q 938 940
A 940 4368
Q 940 941
A 941 2584
Q 941 942
Q 940 942
A 942 2391
Q 942 943
Q 941 943
A 943 11
Q ...

result:

ok Accepted

Test #58:

score: 0
Accepted
time: 18ms
memory: 4244kb

input:

5000
4999
4999
4991
4999
4999
4991
4991
4999
4991
4999
4999
4999
4999
690
3365
2823
3187
155
3187
699
3535
2132
357
2489
2046
2403
532
880
3065
1779
267
2046
1468
1468
746
1468
2764
4133
4375
3567
2444
2772
121
2893
3288
1641
1997
1997
258
1997
3166
1813
1988
1988
261
1988
200
461
1140
1340
2267
226...

output:

Q 2500 5000
Q 3750 5000
Q 4375 5000
Q 4062 5000
Q 4218 5000
Q 4296 5000
Q 4257 5000
Q 4237 5000
Q 4247 5000
Q 4242 5000
Q 4244 5000
Q 4245 5000
Q 4246 5000
A 4246 1
Q 4246 4247
A 4247 691
Q 4245 4246
A 4245 3366
Q 4247 4248
A 4248 3514
Q 4248 4249
A 4249 327
Q 4249 4250
Q 4248 4250
A 4250 482
Q 4250...

result:

ok Accepted

Test #59:

score: 0
Accepted
time: 11ms
memory: 4156kb

input:

5000
4993
4996
4999
4999
4999
4999
4999
4999
4999
4996
4999
4999
4999
3516
4167
158
3516
929
1087
857
929
584
857
95
679
2260
2260
899
700
1599
1292
1292
1799
1128
2927
96
1224
3215
1728
843
2571
709
843
1881
2590
4559
1155
500
1155
1326
94
1420
762
856
2994
3345
2651
2087
2206
2571
1228
2571
2749
3...

output:

Q 2500 5000
Q 1250 5000
Q 625 5000
Q 937 5000
Q 1093 5000
Q 1171 5000
Q 1210 5000
Q 1230 5000
Q 1240 5000
Q 1245 5000
Q 1242 5000
Q 1243 5000
Q 1244 5000
A 1244 1
Q 1244 1245
A 1245 3517
Q 1243 1244
A 1243 4168
Q 1245 1246
Q 1244 1246
A 1246 3359
Q 1246 1247
Q 1245 1247
A 1247 2430
Q 1247 1248
Q 124...

result:

ok Accepted

Test #60:

score: 0
Accepted
time: 4ms
memory: 4180kb

input:

5000
4997
4999
4999
4997
4997
4997
4999
4997
4999
4999
4997
4999
4819
3695
3442
2996
918
938
1856
1349
2287
255
1604
908
908
2269
891
3160
4330
420
4750
4129
392
4521
178
570
4659
260
4919
2332
586
2332
3051
115
3166
378
268
646
1562
12
1574
199
211
736
935
646
1382
930
930
111
1041
2106
2106
4123
6...

output:

Q 2500 5000
Q 1250 5000
Q 1875 5000
Q 2187 5000
Q 2031 5000
Q 1953 5000
Q 1914 5000
Q 1933 5000
Q 1923 5000
Q 1928 5000
Q 1930 5000
Q 1929 5000
A 1929 1
Q 1929 1930
A 1930 4820
Q 1928 1929
A 1928 3696
Q 1930 1931
A 1931 1378
Q 1931 1932
A 1932 4374
Q 1932 1933
A 1933 3456
Q 1933 1934
Q 1932 1934
A 1...

result:

ok Accepted

Extra Test:

score: 0
Extra Test Passed