#include <bits/stdc++.h>
using namespace std;
#include "paint.h"
const int INF = 2e9;
int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) {
map<int, int> toR[N+1];
deque<int> q = {N};
vector<int> cand[K], dp(N+1, INF);
dp[N] = 0;
for(int i = 0; i < M; i++)
for(int &j : B[i])
cand[j].push_back(i);
for(int i = N; --i >= 0; ) {
if(!empty(q) && q.front() > i + M) q.pop_front();
bool ok = 0;
for(int j : cand[C[i]])
if((toR[i][j] = 1 + toR[i+1][(j + 1) % M]) >= M)
ok = 1;
if(ok && !empty(q)) {
dp[i] = 1 + dp[q.front()];
while(!empty(q) && dp[i] <= dp[q.back()])
q.pop_back();
q.push_back(i);
}
}
return dp[0] == INF ? -1 : dp[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
288 KB |
Output is correct |
7 |
Correct |
1 ms |
288 KB |
Output is correct |
8 |
Correct |
0 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
292 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
2 ms |
2636 KB |
Output is correct |
14 |
Correct |
2 ms |
2732 KB |
Output is correct |
15 |
Correct |
2 ms |
2636 KB |
Output is correct |
16 |
Correct |
2 ms |
2636 KB |
Output is correct |
17 |
Correct |
2 ms |
2636 KB |
Output is correct |
18 |
Correct |
2 ms |
2592 KB |
Output is correct |
19 |
Correct |
2 ms |
2592 KB |
Output is correct |
20 |
Correct |
2 ms |
2736 KB |
Output is correct |
21 |
Correct |
2 ms |
2636 KB |
Output is correct |
22 |
Correct |
18 ms |
7080 KB |
Output is correct |
23 |
Correct |
20 ms |
7084 KB |
Output is correct |
24 |
Correct |
21 ms |
7116 KB |
Output is correct |
25 |
Correct |
4 ms |
2348 KB |
Output is correct |
26 |
Correct |
4 ms |
2344 KB |
Output is correct |
27 |
Correct |
4 ms |
2852 KB |
Output is correct |
28 |
Correct |
5 ms |
3020 KB |
Output is correct |
29 |
Correct |
5 ms |
3084 KB |
Output is correct |
30 |
Correct |
7 ms |
3148 KB |
Output is correct |
31 |
Correct |
10 ms |
5796 KB |
Output is correct |
32 |
Correct |
12 ms |
5836 KB |
Output is correct |
33 |
Correct |
9 ms |
5852 KB |
Output is correct |
34 |
Correct |
10 ms |
5828 KB |
Output is correct |
35 |
Correct |
10 ms |
5836 KB |
Output is correct |
36 |
Correct |
12 ms |
5848 KB |
Output is correct |
37 |
Correct |
36 ms |
10432 KB |
Output is correct |
38 |
Correct |
27 ms |
10436 KB |
Output is correct |
39 |
Correct |
30 ms |
10336 KB |
Output is correct |
40 |
Correct |
15 ms |
10060 KB |
Output is correct |
41 |
Correct |
9 ms |
6340 KB |
Output is correct |
42 |
Correct |
21 ms |
13092 KB |
Output is correct |
43 |
Correct |
15 ms |
9376 KB |
Output is correct |
44 |
Correct |
17 ms |
8744 KB |
Output is correct |
45 |
Correct |
25 ms |
14752 KB |
Output is correct |
46 |
Correct |
45 ms |
21152 KB |
Output is correct |
47 |
Correct |
29 ms |
13524 KB |
Output is correct |
48 |
Correct |
33 ms |
15940 KB |
Output is correct |
49 |
Correct |
51 ms |
19584 KB |
Output is correct |
50 |
Correct |
56 ms |
20788 KB |
Output is correct |
51 |
Correct |
47 ms |
18532 KB |
Output is correct |
52 |
Correct |
17 ms |
11004 KB |
Output is correct |
53 |
Correct |
16 ms |
10956 KB |
Output is correct |
54 |
Correct |
22 ms |
13340 KB |
Output is correct |
55 |
Correct |
30 ms |
14068 KB |
Output is correct |
56 |
Correct |
24 ms |
14556 KB |
Output is correct |
57 |
Correct |
27 ms |
14852 KB |
Output is correct |
58 |
Correct |
63 ms |
23364 KB |
Output is correct |
59 |
Correct |
53 ms |
23384 KB |
Output is correct |
60 |
Correct |
52 ms |
23440 KB |
Output is correct |
61 |
Correct |
62 ms |
23376 KB |
Output is correct |
62 |
Correct |
57 ms |
23348 KB |
Output is correct |
63 |
Correct |
54 ms |
23376 KB |
Output is correct |
64 |
Correct |
71 ms |
27272 KB |
Output is correct |
65 |
Correct |
64 ms |
27332 KB |
Output is correct |
66 |
Correct |
71 ms |
27300 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
1 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
288 KB |
Output is correct |
7 |
Correct |
1 ms |
288 KB |
Output is correct |
8 |
Correct |
0 ms |
332 KB |
Output is correct |
9 |
Correct |
1 ms |
292 KB |
Output is correct |
10 |
Correct |
1 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
332 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
2 ms |
2636 KB |
Output is correct |
14 |
Correct |
2 ms |
2732 KB |
Output is correct |
15 |
Correct |
2 ms |
2636 KB |
Output is correct |
16 |
Correct |
2 ms |
2636 KB |
Output is correct |
17 |
Correct |
2 ms |
2636 KB |
Output is correct |
18 |
Correct |
2 ms |
2592 KB |
Output is correct |
19 |
Correct |
2 ms |
2592 KB |
Output is correct |
20 |
Correct |
2 ms |
2736 KB |
Output is correct |
21 |
Correct |
2 ms |
2636 KB |
Output is correct |
22 |
Correct |
0 ms |
288 KB |
Output is correct |
23 |
Correct |
0 ms |
204 KB |
Output is correct |
24 |
Correct |
0 ms |
204 KB |
Output is correct |
25 |
Correct |
1 ms |
292 KB |
Output is correct |
26 |
Correct |
0 ms |
204 KB |
Output is correct |
27 |
Correct |
0 ms |
284 KB |
Output is correct |
28 |
Correct |
2 ms |
716 KB |
Output is correct |
29 |
Correct |
1 ms |
588 KB |
Output is correct |
30 |
Correct |
1 ms |
588 KB |
Output is correct |
31 |
Correct |
1 ms |
460 KB |
Output is correct |
32 |
Correct |
3 ms |
676 KB |
Output is correct |
33 |
Correct |
2 ms |
2252 KB |
Output is correct |
34 |
Correct |
2 ms |
1868 KB |
Output is correct |
35 |
Correct |
1 ms |
1612 KB |
Output is correct |
36 |
Correct |
2 ms |
2600 KB |
Output is correct |
37 |
Correct |
2 ms |
2216 KB |
Output is correct |
38 |
Correct |
2 ms |
2380 KB |
Output is correct |
39 |
Correct |
1 ms |
296 KB |
Output is correct |
40 |
Correct |
2 ms |
2080 KB |
Output is correct |
41 |
Correct |
1 ms |
292 KB |
Output is correct |
42 |
Correct |
2 ms |
2508 KB |
Output is correct |
43 |
Correct |
1 ms |
2468 KB |
Output is correct |
44 |
Correct |
1 ms |
332 KB |
Output is correct |
45 |
Correct |
2 ms |
972 KB |
Output is correct |
46 |
Correct |
2 ms |
972 KB |
Output is correct |
47 |
Correct |
2 ms |
972 KB |
Output is correct |
48 |
Correct |
2 ms |
844 KB |
Output is correct |
49 |
Correct |
2 ms |
800 KB |
Output is correct |
50 |
Correct |
2 ms |
2636 KB |
Output is correct |
51 |
Correct |
2 ms |
2636 KB |
Output is correct |
52 |
Correct |
2 ms |
2688 KB |
Output is correct |
53 |
Correct |
2 ms |
2636 KB |
Output is correct |
54 |
Correct |
2 ms |
2636 KB |
Output is correct |
55 |
Correct |
2 ms |
2728 KB |
Output is correct |
56 |
Correct |
3 ms |
2728 KB |
Output is correct |
57 |
Correct |
1 ms |
332 KB |
Output is correct |
58 |
Correct |
2 ms |
2740 KB |
Output is correct |
59 |
Correct |
1 ms |
332 KB |
Output is correct |
60 |
Correct |
2 ms |
2636 KB |
Output is correct |
61 |
Correct |
1 ms |
332 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
288 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
288 KB |
Output is correct |
9 |
Correct |
1 ms |
288 KB |
Output is correct |
10 |
Correct |
0 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
292 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
2636 KB |
Output is correct |
16 |
Correct |
2 ms |
2732 KB |
Output is correct |
17 |
Correct |
2 ms |
2636 KB |
Output is correct |
18 |
Correct |
2 ms |
2636 KB |
Output is correct |
19 |
Correct |
2 ms |
2636 KB |
Output is correct |
20 |
Correct |
2 ms |
2592 KB |
Output is correct |
21 |
Correct |
2 ms |
2592 KB |
Output is correct |
22 |
Correct |
2 ms |
2736 KB |
Output is correct |
23 |
Correct |
2 ms |
2636 KB |
Output is correct |
24 |
Correct |
18 ms |
7080 KB |
Output is correct |
25 |
Correct |
20 ms |
7084 KB |
Output is correct |
26 |
Correct |
21 ms |
7116 KB |
Output is correct |
27 |
Correct |
0 ms |
204 KB |
Output is correct |
28 |
Correct |
1 ms |
292 KB |
Output is correct |
29 |
Correct |
0 ms |
204 KB |
Output is correct |
30 |
Correct |
0 ms |
284 KB |
Output is correct |
31 |
Correct |
2 ms |
716 KB |
Output is correct |
32 |
Correct |
1 ms |
588 KB |
Output is correct |
33 |
Correct |
1 ms |
588 KB |
Output is correct |
34 |
Correct |
1 ms |
460 KB |
Output is correct |
35 |
Correct |
3 ms |
676 KB |
Output is correct |
36 |
Correct |
2 ms |
2252 KB |
Output is correct |
37 |
Correct |
2 ms |
1868 KB |
Output is correct |
38 |
Correct |
1 ms |
1612 KB |
Output is correct |
39 |
Correct |
2 ms |
2600 KB |
Output is correct |
40 |
Correct |
2 ms |
2216 KB |
Output is correct |
41 |
Correct |
2 ms |
2380 KB |
Output is correct |
42 |
Correct |
1 ms |
296 KB |
Output is correct |
43 |
Correct |
2 ms |
2080 KB |
Output is correct |
44 |
Correct |
1 ms |
292 KB |
Output is correct |
45 |
Correct |
2 ms |
2508 KB |
Output is correct |
46 |
Correct |
1 ms |
2468 KB |
Output is correct |
47 |
Correct |
1 ms |
332 KB |
Output is correct |
48 |
Correct |
2 ms |
972 KB |
Output is correct |
49 |
Correct |
2 ms |
972 KB |
Output is correct |
50 |
Correct |
2 ms |
972 KB |
Output is correct |
51 |
Correct |
2 ms |
844 KB |
Output is correct |
52 |
Correct |
2 ms |
800 KB |
Output is correct |
53 |
Correct |
2 ms |
2636 KB |
Output is correct |
54 |
Correct |
2 ms |
2636 KB |
Output is correct |
55 |
Correct |
2 ms |
2688 KB |
Output is correct |
56 |
Correct |
2 ms |
2636 KB |
Output is correct |
57 |
Correct |
2 ms |
2636 KB |
Output is correct |
58 |
Correct |
2 ms |
2728 KB |
Output is correct |
59 |
Correct |
3 ms |
2728 KB |
Output is correct |
60 |
Correct |
1 ms |
332 KB |
Output is correct |
61 |
Correct |
2 ms |
2740 KB |
Output is correct |
62 |
Correct |
1 ms |
332 KB |
Output is correct |
63 |
Correct |
2 ms |
2636 KB |
Output is correct |
64 |
Correct |
1 ms |
332 KB |
Output is correct |
65 |
Correct |
7 ms |
2508 KB |
Output is correct |
66 |
Correct |
3 ms |
1176 KB |
Output is correct |
67 |
Correct |
10 ms |
3108 KB |
Output is correct |
68 |
Correct |
5 ms |
1868 KB |
Output is correct |
69 |
Correct |
9 ms |
2720 KB |
Output is correct |
70 |
Correct |
4 ms |
2992 KB |
Output is correct |
71 |
Correct |
5 ms |
2636 KB |
Output is correct |
72 |
Correct |
4 ms |
2380 KB |
Output is correct |
73 |
Correct |
3 ms |
2256 KB |
Output is correct |
74 |
Correct |
5 ms |
2892 KB |
Output is correct |
75 |
Correct |
4 ms |
3120 KB |
Output is correct |
76 |
Correct |
18 ms |
5292 KB |
Output is correct |
77 |
Correct |
17 ms |
6052 KB |
Output is correct |
78 |
Correct |
22 ms |
6856 KB |
Output is correct |
79 |
Correct |
14 ms |
4940 KB |
Output is correct |
80 |
Correct |
14 ms |
4956 KB |
Output is correct |
81 |
Correct |
17 ms |
5024 KB |
Output is correct |
82 |
Correct |
15 ms |
4940 KB |
Output is correct |
83 |
Correct |
15 ms |
5012 KB |
Output is correct |
84 |
Correct |
6 ms |
3708 KB |
Output is correct |
85 |
Correct |
5 ms |
3532 KB |
Output is correct |
86 |
Correct |
5 ms |
3532 KB |
Output is correct |
87 |
Correct |
5 ms |
3504 KB |
Output is correct |
88 |
Correct |
4 ms |
3532 KB |
Output is correct |
89 |
Correct |
5 ms |
3532 KB |
Output is correct |
90 |
Correct |
27 ms |
7348 KB |
Output is correct |
91 |
Correct |
27 ms |
7236 KB |
Output is correct |
92 |
Correct |
28 ms |
7348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
288 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
288 KB |
Output is correct |
9 |
Correct |
1 ms |
288 KB |
Output is correct |
10 |
Correct |
0 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
292 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
2636 KB |
Output is correct |
16 |
Correct |
2 ms |
2732 KB |
Output is correct |
17 |
Correct |
2 ms |
2636 KB |
Output is correct |
18 |
Correct |
2 ms |
2636 KB |
Output is correct |
19 |
Correct |
2 ms |
2636 KB |
Output is correct |
20 |
Correct |
2 ms |
2592 KB |
Output is correct |
21 |
Correct |
2 ms |
2592 KB |
Output is correct |
22 |
Correct |
2 ms |
2736 KB |
Output is correct |
23 |
Correct |
2 ms |
2636 KB |
Output is correct |
24 |
Correct |
18 ms |
7080 KB |
Output is correct |
25 |
Correct |
20 ms |
7084 KB |
Output is correct |
26 |
Correct |
21 ms |
7116 KB |
Output is correct |
27 |
Correct |
4 ms |
2348 KB |
Output is correct |
28 |
Correct |
4 ms |
2344 KB |
Output is correct |
29 |
Correct |
4 ms |
2852 KB |
Output is correct |
30 |
Correct |
5 ms |
3020 KB |
Output is correct |
31 |
Correct |
5 ms |
3084 KB |
Output is correct |
32 |
Correct |
7 ms |
3148 KB |
Output is correct |
33 |
Correct |
10 ms |
5796 KB |
Output is correct |
34 |
Correct |
12 ms |
5836 KB |
Output is correct |
35 |
Correct |
9 ms |
5852 KB |
Output is correct |
36 |
Correct |
10 ms |
5828 KB |
Output is correct |
37 |
Correct |
10 ms |
5836 KB |
Output is correct |
38 |
Correct |
12 ms |
5848 KB |
Output is correct |
39 |
Correct |
36 ms |
10432 KB |
Output is correct |
40 |
Correct |
27 ms |
10436 KB |
Output is correct |
41 |
Correct |
30 ms |
10336 KB |
Output is correct |
42 |
Correct |
0 ms |
204 KB |
Output is correct |
43 |
Correct |
1 ms |
292 KB |
Output is correct |
44 |
Correct |
0 ms |
204 KB |
Output is correct |
45 |
Correct |
0 ms |
284 KB |
Output is correct |
46 |
Correct |
2 ms |
716 KB |
Output is correct |
47 |
Correct |
1 ms |
588 KB |
Output is correct |
48 |
Correct |
1 ms |
588 KB |
Output is correct |
49 |
Correct |
1 ms |
460 KB |
Output is correct |
50 |
Correct |
3 ms |
676 KB |
Output is correct |
51 |
Correct |
2 ms |
2252 KB |
Output is correct |
52 |
Correct |
2 ms |
1868 KB |
Output is correct |
53 |
Correct |
1 ms |
1612 KB |
Output is correct |
54 |
Correct |
2 ms |
2600 KB |
Output is correct |
55 |
Correct |
2 ms |
2216 KB |
Output is correct |
56 |
Correct |
2 ms |
2380 KB |
Output is correct |
57 |
Correct |
1 ms |
296 KB |
Output is correct |
58 |
Correct |
2 ms |
2080 KB |
Output is correct |
59 |
Correct |
1 ms |
292 KB |
Output is correct |
60 |
Correct |
2 ms |
2508 KB |
Output is correct |
61 |
Correct |
1 ms |
2468 KB |
Output is correct |
62 |
Correct |
1 ms |
332 KB |
Output is correct |
63 |
Correct |
2 ms |
972 KB |
Output is correct |
64 |
Correct |
2 ms |
972 KB |
Output is correct |
65 |
Correct |
2 ms |
972 KB |
Output is correct |
66 |
Correct |
2 ms |
844 KB |
Output is correct |
67 |
Correct |
2 ms |
800 KB |
Output is correct |
68 |
Correct |
2 ms |
2636 KB |
Output is correct |
69 |
Correct |
2 ms |
2636 KB |
Output is correct |
70 |
Correct |
2 ms |
2688 KB |
Output is correct |
71 |
Correct |
2 ms |
2636 KB |
Output is correct |
72 |
Correct |
2 ms |
2636 KB |
Output is correct |
73 |
Correct |
2 ms |
2728 KB |
Output is correct |
74 |
Correct |
3 ms |
2728 KB |
Output is correct |
75 |
Correct |
1 ms |
332 KB |
Output is correct |
76 |
Correct |
2 ms |
2740 KB |
Output is correct |
77 |
Correct |
1 ms |
332 KB |
Output is correct |
78 |
Correct |
2 ms |
2636 KB |
Output is correct |
79 |
Correct |
1 ms |
332 KB |
Output is correct |
80 |
Correct |
7 ms |
2508 KB |
Output is correct |
81 |
Correct |
3 ms |
1176 KB |
Output is correct |
82 |
Correct |
10 ms |
3108 KB |
Output is correct |
83 |
Correct |
5 ms |
1868 KB |
Output is correct |
84 |
Correct |
9 ms |
2720 KB |
Output is correct |
85 |
Correct |
4 ms |
2992 KB |
Output is correct |
86 |
Correct |
5 ms |
2636 KB |
Output is correct |
87 |
Correct |
4 ms |
2380 KB |
Output is correct |
88 |
Correct |
3 ms |
2256 KB |
Output is correct |
89 |
Correct |
5 ms |
2892 KB |
Output is correct |
90 |
Correct |
4 ms |
3120 KB |
Output is correct |
91 |
Correct |
18 ms |
5292 KB |
Output is correct |
92 |
Correct |
17 ms |
6052 KB |
Output is correct |
93 |
Correct |
22 ms |
6856 KB |
Output is correct |
94 |
Correct |
14 ms |
4940 KB |
Output is correct |
95 |
Correct |
14 ms |
4956 KB |
Output is correct |
96 |
Correct |
17 ms |
5024 KB |
Output is correct |
97 |
Correct |
15 ms |
4940 KB |
Output is correct |
98 |
Correct |
15 ms |
5012 KB |
Output is correct |
99 |
Correct |
6 ms |
3708 KB |
Output is correct |
100 |
Correct |
5 ms |
3532 KB |
Output is correct |
101 |
Correct |
5 ms |
3532 KB |
Output is correct |
102 |
Correct |
5 ms |
3504 KB |
Output is correct |
103 |
Correct |
4 ms |
3532 KB |
Output is correct |
104 |
Correct |
5 ms |
3532 KB |
Output is correct |
105 |
Correct |
27 ms |
7348 KB |
Output is correct |
106 |
Correct |
27 ms |
7236 KB |
Output is correct |
107 |
Correct |
28 ms |
7348 KB |
Output is correct |
108 |
Correct |
5 ms |
3240 KB |
Output is correct |
109 |
Correct |
1394 ms |
422272 KB |
Output is correct |
110 |
Correct |
946 ms |
317676 KB |
Output is correct |
111 |
Correct |
762 ms |
260996 KB |
Output is correct |
112 |
Correct |
916 ms |
318984 KB |
Output is correct |
113 |
Correct |
657 ms |
223528 KB |
Output is correct |
114 |
Correct |
17 ms |
7324 KB |
Output is correct |
115 |
Correct |
17 ms |
7168 KB |
Output is correct |
116 |
Correct |
20 ms |
8616 KB |
Output is correct |
117 |
Correct |
15 ms |
6452 KB |
Output is correct |
118 |
Correct |
18 ms |
7636 KB |
Output is correct |
119 |
Correct |
16 ms |
6520 KB |
Output is correct |
120 |
Correct |
22 ms |
6976 KB |
Output is correct |
121 |
Correct |
9 ms |
3376 KB |
Output is correct |
122 |
Correct |
32 ms |
7792 KB |
Output is correct |
123 |
Correct |
7 ms |
3236 KB |
Output is correct |
124 |
Correct |
34 ms |
9860 KB |
Output is correct |
125 |
Correct |
13 ms |
5080 KB |
Output is correct |
126 |
Correct |
13 ms |
4452 KB |
Output is correct |
127 |
Correct |
11 ms |
5732 KB |
Output is correct |
128 |
Correct |
7 ms |
4604 KB |
Output is correct |
129 |
Correct |
8 ms |
4144 KB |
Output is correct |
130 |
Correct |
5 ms |
3276 KB |
Output is correct |
131 |
Runtime error |
1338 ms |
524292 KB |
Execution killed with signal 9 |
132 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
288 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
1 ms |
204 KB |
Output is correct |
4 |
Correct |
1 ms |
204 KB |
Output is correct |
5 |
Correct |
1 ms |
204 KB |
Output is correct |
6 |
Correct |
0 ms |
204 KB |
Output is correct |
7 |
Correct |
0 ms |
204 KB |
Output is correct |
8 |
Correct |
0 ms |
288 KB |
Output is correct |
9 |
Correct |
1 ms |
288 KB |
Output is correct |
10 |
Correct |
0 ms |
332 KB |
Output is correct |
11 |
Correct |
1 ms |
292 KB |
Output is correct |
12 |
Correct |
1 ms |
332 KB |
Output is correct |
13 |
Correct |
1 ms |
332 KB |
Output is correct |
14 |
Correct |
1 ms |
332 KB |
Output is correct |
15 |
Correct |
2 ms |
2636 KB |
Output is correct |
16 |
Correct |
2 ms |
2732 KB |
Output is correct |
17 |
Correct |
2 ms |
2636 KB |
Output is correct |
18 |
Correct |
2 ms |
2636 KB |
Output is correct |
19 |
Correct |
2 ms |
2636 KB |
Output is correct |
20 |
Correct |
2 ms |
2592 KB |
Output is correct |
21 |
Correct |
2 ms |
2592 KB |
Output is correct |
22 |
Correct |
2 ms |
2736 KB |
Output is correct |
23 |
Correct |
2 ms |
2636 KB |
Output is correct |
24 |
Correct |
18 ms |
7080 KB |
Output is correct |
25 |
Correct |
20 ms |
7084 KB |
Output is correct |
26 |
Correct |
21 ms |
7116 KB |
Output is correct |
27 |
Correct |
4 ms |
2348 KB |
Output is correct |
28 |
Correct |
4 ms |
2344 KB |
Output is correct |
29 |
Correct |
4 ms |
2852 KB |
Output is correct |
30 |
Correct |
5 ms |
3020 KB |
Output is correct |
31 |
Correct |
5 ms |
3084 KB |
Output is correct |
32 |
Correct |
7 ms |
3148 KB |
Output is correct |
33 |
Correct |
10 ms |
5796 KB |
Output is correct |
34 |
Correct |
12 ms |
5836 KB |
Output is correct |
35 |
Correct |
9 ms |
5852 KB |
Output is correct |
36 |
Correct |
10 ms |
5828 KB |
Output is correct |
37 |
Correct |
10 ms |
5836 KB |
Output is correct |
38 |
Correct |
12 ms |
5848 KB |
Output is correct |
39 |
Correct |
36 ms |
10432 KB |
Output is correct |
40 |
Correct |
27 ms |
10436 KB |
Output is correct |
41 |
Correct |
30 ms |
10336 KB |
Output is correct |
42 |
Correct |
15 ms |
10060 KB |
Output is correct |
43 |
Correct |
9 ms |
6340 KB |
Output is correct |
44 |
Correct |
21 ms |
13092 KB |
Output is correct |
45 |
Correct |
15 ms |
9376 KB |
Output is correct |
46 |
Correct |
17 ms |
8744 KB |
Output is correct |
47 |
Correct |
25 ms |
14752 KB |
Output is correct |
48 |
Correct |
45 ms |
21152 KB |
Output is correct |
49 |
Correct |
29 ms |
13524 KB |
Output is correct |
50 |
Correct |
33 ms |
15940 KB |
Output is correct |
51 |
Correct |
51 ms |
19584 KB |
Output is correct |
52 |
Correct |
56 ms |
20788 KB |
Output is correct |
53 |
Correct |
47 ms |
18532 KB |
Output is correct |
54 |
Correct |
17 ms |
11004 KB |
Output is correct |
55 |
Correct |
16 ms |
10956 KB |
Output is correct |
56 |
Correct |
22 ms |
13340 KB |
Output is correct |
57 |
Correct |
30 ms |
14068 KB |
Output is correct |
58 |
Correct |
24 ms |
14556 KB |
Output is correct |
59 |
Correct |
27 ms |
14852 KB |
Output is correct |
60 |
Correct |
63 ms |
23364 KB |
Output is correct |
61 |
Correct |
53 ms |
23384 KB |
Output is correct |
62 |
Correct |
52 ms |
23440 KB |
Output is correct |
63 |
Correct |
62 ms |
23376 KB |
Output is correct |
64 |
Correct |
57 ms |
23348 KB |
Output is correct |
65 |
Correct |
54 ms |
23376 KB |
Output is correct |
66 |
Correct |
71 ms |
27272 KB |
Output is correct |
67 |
Correct |
64 ms |
27332 KB |
Output is correct |
68 |
Correct |
71 ms |
27300 KB |
Output is correct |
69 |
Correct |
0 ms |
204 KB |
Output is correct |
70 |
Correct |
1 ms |
292 KB |
Output is correct |
71 |
Correct |
0 ms |
204 KB |
Output is correct |
72 |
Correct |
0 ms |
284 KB |
Output is correct |
73 |
Correct |
2 ms |
716 KB |
Output is correct |
74 |
Correct |
1 ms |
588 KB |
Output is correct |
75 |
Correct |
1 ms |
588 KB |
Output is correct |
76 |
Correct |
1 ms |
460 KB |
Output is correct |
77 |
Correct |
3 ms |
676 KB |
Output is correct |
78 |
Correct |
2 ms |
2252 KB |
Output is correct |
79 |
Correct |
2 ms |
1868 KB |
Output is correct |
80 |
Correct |
1 ms |
1612 KB |
Output is correct |
81 |
Correct |
2 ms |
2600 KB |
Output is correct |
82 |
Correct |
2 ms |
2216 KB |
Output is correct |
83 |
Correct |
2 ms |
2380 KB |
Output is correct |
84 |
Correct |
1 ms |
296 KB |
Output is correct |
85 |
Correct |
2 ms |
2080 KB |
Output is correct |
86 |
Correct |
1 ms |
292 KB |
Output is correct |
87 |
Correct |
2 ms |
2508 KB |
Output is correct |
88 |
Correct |
1 ms |
2468 KB |
Output is correct |
89 |
Correct |
1 ms |
332 KB |
Output is correct |
90 |
Correct |
2 ms |
972 KB |
Output is correct |
91 |
Correct |
2 ms |
972 KB |
Output is correct |
92 |
Correct |
2 ms |
972 KB |
Output is correct |
93 |
Correct |
2 ms |
844 KB |
Output is correct |
94 |
Correct |
2 ms |
800 KB |
Output is correct |
95 |
Correct |
2 ms |
2636 KB |
Output is correct |
96 |
Correct |
2 ms |
2636 KB |
Output is correct |
97 |
Correct |
2 ms |
2688 KB |
Output is correct |
98 |
Correct |
2 ms |
2636 KB |
Output is correct |
99 |
Correct |
2 ms |
2636 KB |
Output is correct |
100 |
Correct |
2 ms |
2728 KB |
Output is correct |
101 |
Correct |
3 ms |
2728 KB |
Output is correct |
102 |
Correct |
1 ms |
332 KB |
Output is correct |
103 |
Correct |
2 ms |
2740 KB |
Output is correct |
104 |
Correct |
1 ms |
332 KB |
Output is correct |
105 |
Correct |
2 ms |
2636 KB |
Output is correct |
106 |
Correct |
1 ms |
332 KB |
Output is correct |
107 |
Correct |
7 ms |
2508 KB |
Output is correct |
108 |
Correct |
3 ms |
1176 KB |
Output is correct |
109 |
Correct |
10 ms |
3108 KB |
Output is correct |
110 |
Correct |
5 ms |
1868 KB |
Output is correct |
111 |
Correct |
9 ms |
2720 KB |
Output is correct |
112 |
Correct |
4 ms |
2992 KB |
Output is correct |
113 |
Correct |
5 ms |
2636 KB |
Output is correct |
114 |
Correct |
4 ms |
2380 KB |
Output is correct |
115 |
Correct |
3 ms |
2256 KB |
Output is correct |
116 |
Correct |
5 ms |
2892 KB |
Output is correct |
117 |
Correct |
4 ms |
3120 KB |
Output is correct |
118 |
Correct |
18 ms |
5292 KB |
Output is correct |
119 |
Correct |
17 ms |
6052 KB |
Output is correct |
120 |
Correct |
22 ms |
6856 KB |
Output is correct |
121 |
Correct |
14 ms |
4940 KB |
Output is correct |
122 |
Correct |
14 ms |
4956 KB |
Output is correct |
123 |
Correct |
17 ms |
5024 KB |
Output is correct |
124 |
Correct |
15 ms |
4940 KB |
Output is correct |
125 |
Correct |
15 ms |
5012 KB |
Output is correct |
126 |
Correct |
6 ms |
3708 KB |
Output is correct |
127 |
Correct |
5 ms |
3532 KB |
Output is correct |
128 |
Correct |
5 ms |
3532 KB |
Output is correct |
129 |
Correct |
5 ms |
3504 KB |
Output is correct |
130 |
Correct |
4 ms |
3532 KB |
Output is correct |
131 |
Correct |
5 ms |
3532 KB |
Output is correct |
132 |
Correct |
27 ms |
7348 KB |
Output is correct |
133 |
Correct |
27 ms |
7236 KB |
Output is correct |
134 |
Correct |
28 ms |
7348 KB |
Output is correct |
135 |
Correct |
5 ms |
3240 KB |
Output is correct |
136 |
Correct |
1394 ms |
422272 KB |
Output is correct |
137 |
Correct |
946 ms |
317676 KB |
Output is correct |
138 |
Correct |
762 ms |
260996 KB |
Output is correct |
139 |
Correct |
916 ms |
318984 KB |
Output is correct |
140 |
Correct |
657 ms |
223528 KB |
Output is correct |
141 |
Correct |
17 ms |
7324 KB |
Output is correct |
142 |
Correct |
17 ms |
7168 KB |
Output is correct |
143 |
Correct |
20 ms |
8616 KB |
Output is correct |
144 |
Correct |
15 ms |
6452 KB |
Output is correct |
145 |
Correct |
18 ms |
7636 KB |
Output is correct |
146 |
Correct |
16 ms |
6520 KB |
Output is correct |
147 |
Correct |
22 ms |
6976 KB |
Output is correct |
148 |
Correct |
9 ms |
3376 KB |
Output is correct |
149 |
Correct |
32 ms |
7792 KB |
Output is correct |
150 |
Correct |
7 ms |
3236 KB |
Output is correct |
151 |
Correct |
34 ms |
9860 KB |
Output is correct |
152 |
Correct |
13 ms |
5080 KB |
Output is correct |
153 |
Correct |
13 ms |
4452 KB |
Output is correct |
154 |
Correct |
11 ms |
5732 KB |
Output is correct |
155 |
Correct |
7 ms |
4604 KB |
Output is correct |
156 |
Correct |
8 ms |
4144 KB |
Output is correct |
157 |
Correct |
5 ms |
3276 KB |
Output is correct |
158 |
Runtime error |
1338 ms |
524292 KB |
Execution killed with signal 9 |
159 |
Halted |
0 ms |
0 KB |
- |