#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll, ll> pll;
#define all(x) (x).begin(),(x).end()
#define X first
#define Y second
#define sep ' '
#define endl '\n'
#define debug(x) cerr << #x << ": " << x << endl;
const ll MAXN = 1e6 + 10;
const ll INF = 2e18;
const ll MOD = 1e9 + 7; // 998244353; // 1e9 + 9;
int n, m, k, C[MAXN];
vector<int> L[MAXN];
pair<int, int> W[2][MAXN];
ll dp[MAXN];
int minimumInstructions(
int N, int M, int K, std::vector<int> tC,
std::vector<int> tA, std::vector<std::vector<int>> tB) {
n = N, m = M, k = K;
for (int i = 0; i < n; i++) C[i] = tC[i];
for (int i = 0; i < m; i++)
for (int e : tB[i])
L[e].push_back(i);
set<pll> dp_st;
dp_st.insert({0, n});
for (int i = 0; i < MAXN; i++) W[n & 1][i] = {0, n};
for (int i = n - 1; i >= 0; i--) {
int ind = i & 1;
dp[i] = INF;
dp_st.erase({dp[i + m + 1], i + m + 1});
ll t = dp_st.begin() -> X;
for (int p : L[C[i]]) {
int l = 1, r = (p + 1) % m;
if (W[1 - ind][r].Y == i + 1) l = 1 + W[1 - ind][r].X;
if (l >= m) dp[i] = t + 1;
W[ind][p] = {l, i};
}
dp_st.insert({dp[i], i});
}
if (dp[0] >= INF) return -1;
return dp[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
31564 KB |
Output is correct |
2 |
Correct |
22 ms |
31564 KB |
Output is correct |
3 |
Correct |
23 ms |
31520 KB |
Output is correct |
4 |
Correct |
21 ms |
31564 KB |
Output is correct |
5 |
Correct |
22 ms |
31604 KB |
Output is correct |
6 |
Correct |
21 ms |
31564 KB |
Output is correct |
7 |
Correct |
23 ms |
31564 KB |
Output is correct |
8 |
Correct |
22 ms |
31640 KB |
Output is correct |
9 |
Correct |
22 ms |
31580 KB |
Output is correct |
10 |
Correct |
23 ms |
31596 KB |
Output is correct |
11 |
Correct |
22 ms |
31600 KB |
Output is correct |
12 |
Correct |
23 ms |
31648 KB |
Output is correct |
13 |
Correct |
23 ms |
31692 KB |
Output is correct |
14 |
Correct |
24 ms |
31680 KB |
Output is correct |
15 |
Correct |
23 ms |
31608 KB |
Output is correct |
16 |
Correct |
25 ms |
31700 KB |
Output is correct |
17 |
Correct |
22 ms |
31704 KB |
Output is correct |
18 |
Correct |
24 ms |
31596 KB |
Output is correct |
19 |
Correct |
22 ms |
31612 KB |
Output is correct |
20 |
Correct |
24 ms |
31692 KB |
Output is correct |
21 |
Correct |
24 ms |
31692 KB |
Output is correct |
22 |
Correct |
46 ms |
36048 KB |
Output is correct |
23 |
Correct |
45 ms |
36004 KB |
Output is correct |
24 |
Correct |
46 ms |
36036 KB |
Output is correct |
25 |
Correct |
25 ms |
32032 KB |
Output is correct |
26 |
Correct |
27 ms |
31948 KB |
Output is correct |
27 |
Correct |
28 ms |
32064 KB |
Output is correct |
28 |
Correct |
26 ms |
31948 KB |
Output is correct |
29 |
Correct |
26 ms |
31936 KB |
Output is correct |
30 |
Correct |
26 ms |
31944 KB |
Output is correct |
31 |
Correct |
38 ms |
33220 KB |
Output is correct |
32 |
Correct |
38 ms |
33216 KB |
Output is correct |
33 |
Correct |
40 ms |
33268 KB |
Output is correct |
34 |
Correct |
42 ms |
33228 KB |
Output is correct |
35 |
Correct |
37 ms |
33228 KB |
Output is correct |
36 |
Correct |
38 ms |
33188 KB |
Output is correct |
37 |
Correct |
65 ms |
36660 KB |
Output is correct |
38 |
Correct |
63 ms |
36728 KB |
Output is correct |
39 |
Correct |
59 ms |
36676 KB |
Output is correct |
40 |
Correct |
37 ms |
33528 KB |
Output is correct |
41 |
Correct |
31 ms |
32756 KB |
Output is correct |
42 |
Correct |
42 ms |
33716 KB |
Output is correct |
43 |
Correct |
41 ms |
32972 KB |
Output is correct |
44 |
Correct |
33 ms |
32900 KB |
Output is correct |
45 |
Correct |
42 ms |
33716 KB |
Output is correct |
46 |
Correct |
111 ms |
45624 KB |
Output is correct |
47 |
Correct |
76 ms |
39516 KB |
Output is correct |
48 |
Correct |
85 ms |
43580 KB |
Output is correct |
49 |
Correct |
99 ms |
43204 KB |
Output is correct |
50 |
Correct |
103 ms |
42632 KB |
Output is correct |
51 |
Correct |
90 ms |
39428 KB |
Output is correct |
52 |
Correct |
38 ms |
33736 KB |
Output is correct |
53 |
Correct |
38 ms |
33868 KB |
Output is correct |
54 |
Correct |
41 ms |
33784 KB |
Output is correct |
55 |
Correct |
41 ms |
33784 KB |
Output is correct |
56 |
Correct |
41 ms |
33656 KB |
Output is correct |
57 |
Correct |
42 ms |
33732 KB |
Output is correct |
58 |
Correct |
121 ms |
46560 KB |
Output is correct |
59 |
Correct |
119 ms |
46548 KB |
Output is correct |
60 |
Correct |
120 ms |
46536 KB |
Output is correct |
61 |
Correct |
123 ms |
46568 KB |
Output is correct |
62 |
Correct |
124 ms |
46716 KB |
Output is correct |
63 |
Correct |
127 ms |
46560 KB |
Output is correct |
64 |
Correct |
136 ms |
45444 KB |
Output is correct |
65 |
Correct |
138 ms |
45304 KB |
Output is correct |
66 |
Correct |
142 ms |
45304 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
22 ms |
31564 KB |
Output is correct |
2 |
Correct |
22 ms |
31564 KB |
Output is correct |
3 |
Correct |
23 ms |
31520 KB |
Output is correct |
4 |
Correct |
21 ms |
31564 KB |
Output is correct |
5 |
Correct |
22 ms |
31604 KB |
Output is correct |
6 |
Correct |
21 ms |
31564 KB |
Output is correct |
7 |
Correct |
23 ms |
31564 KB |
Output is correct |
8 |
Correct |
22 ms |
31640 KB |
Output is correct |
9 |
Correct |
22 ms |
31580 KB |
Output is correct |
10 |
Correct |
23 ms |
31596 KB |
Output is correct |
11 |
Correct |
22 ms |
31600 KB |
Output is correct |
12 |
Correct |
23 ms |
31648 KB |
Output is correct |
13 |
Correct |
23 ms |
31692 KB |
Output is correct |
14 |
Correct |
24 ms |
31680 KB |
Output is correct |
15 |
Correct |
23 ms |
31608 KB |
Output is correct |
16 |
Correct |
25 ms |
31700 KB |
Output is correct |
17 |
Correct |
22 ms |
31704 KB |
Output is correct |
18 |
Correct |
24 ms |
31596 KB |
Output is correct |
19 |
Correct |
22 ms |
31612 KB |
Output is correct |
20 |
Correct |
24 ms |
31692 KB |
Output is correct |
21 |
Correct |
24 ms |
31692 KB |
Output is correct |
22 |
Correct |
21 ms |
31564 KB |
Output is correct |
23 |
Correct |
22 ms |
31604 KB |
Output is correct |
24 |
Correct |
26 ms |
31616 KB |
Output is correct |
25 |
Correct |
22 ms |
31564 KB |
Output is correct |
26 |
Correct |
23 ms |
31520 KB |
Output is correct |
27 |
Correct |
22 ms |
31608 KB |
Output is correct |
28 |
Correct |
21 ms |
31608 KB |
Output is correct |
29 |
Correct |
23 ms |
31596 KB |
Output is correct |
30 |
Correct |
22 ms |
31644 KB |
Output is correct |
31 |
Correct |
22 ms |
31564 KB |
Output is correct |
32 |
Correct |
22 ms |
31564 KB |
Output is correct |
33 |
Correct |
22 ms |
31608 KB |
Output is correct |
34 |
Correct |
23 ms |
31684 KB |
Output is correct |
35 |
Correct |
23 ms |
31664 KB |
Output is correct |
36 |
Correct |
22 ms |
31564 KB |
Output is correct |
37 |
Correct |
24 ms |
31564 KB |
Output is correct |
38 |
Correct |
22 ms |
31680 KB |
Output is correct |
39 |
Correct |
22 ms |
31556 KB |
Output is correct |
40 |
Correct |
24 ms |
31692 KB |
Output is correct |
41 |
Correct |
22 ms |
31564 KB |
Output is correct |
42 |
Correct |
23 ms |
31564 KB |
Output is correct |
43 |
Correct |
22 ms |
31624 KB |
Output is correct |
44 |
Correct |
23 ms |
31564 KB |
Output is correct |
45 |
Correct |
22 ms |
31632 KB |
Output is correct |
46 |
Correct |
22 ms |
31564 KB |
Output is correct |
47 |
Correct |
22 ms |
31564 KB |
Output is correct |
48 |
Correct |
22 ms |
31624 KB |
Output is correct |
49 |
Correct |
22 ms |
31564 KB |
Output is correct |
50 |
Correct |
25 ms |
31616 KB |
Output is correct |
51 |
Correct |
25 ms |
31728 KB |
Output is correct |
52 |
Correct |
23 ms |
31604 KB |
Output is correct |
53 |
Correct |
22 ms |
31708 KB |
Output is correct |
54 |
Correct |
22 ms |
31604 KB |
Output is correct |
55 |
Correct |
24 ms |
31664 KB |
Output is correct |
56 |
Correct |
22 ms |
31612 KB |
Output is correct |
57 |
Correct |
22 ms |
31608 KB |
Output is correct |
58 |
Correct |
23 ms |
31688 KB |
Output is correct |
59 |
Correct |
25 ms |
31676 KB |
Output is correct |
60 |
Correct |
23 ms |
31716 KB |
Output is correct |
61 |
Correct |
23 ms |
31692 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
31564 KB |
Output is correct |
2 |
Correct |
22 ms |
31604 KB |
Output is correct |
3 |
Correct |
22 ms |
31564 KB |
Output is correct |
4 |
Correct |
22 ms |
31564 KB |
Output is correct |
5 |
Correct |
23 ms |
31520 KB |
Output is correct |
6 |
Correct |
21 ms |
31564 KB |
Output is correct |
7 |
Correct |
22 ms |
31604 KB |
Output is correct |
8 |
Correct |
21 ms |
31564 KB |
Output is correct |
9 |
Correct |
23 ms |
31564 KB |
Output is correct |
10 |
Correct |
22 ms |
31640 KB |
Output is correct |
11 |
Correct |
22 ms |
31580 KB |
Output is correct |
12 |
Correct |
23 ms |
31596 KB |
Output is correct |
13 |
Correct |
22 ms |
31600 KB |
Output is correct |
14 |
Correct |
23 ms |
31648 KB |
Output is correct |
15 |
Correct |
23 ms |
31692 KB |
Output is correct |
16 |
Correct |
24 ms |
31680 KB |
Output is correct |
17 |
Correct |
23 ms |
31608 KB |
Output is correct |
18 |
Correct |
25 ms |
31700 KB |
Output is correct |
19 |
Correct |
22 ms |
31704 KB |
Output is correct |
20 |
Correct |
24 ms |
31596 KB |
Output is correct |
21 |
Correct |
22 ms |
31612 KB |
Output is correct |
22 |
Correct |
24 ms |
31692 KB |
Output is correct |
23 |
Correct |
24 ms |
31692 KB |
Output is correct |
24 |
Correct |
46 ms |
36048 KB |
Output is correct |
25 |
Correct |
45 ms |
36004 KB |
Output is correct |
26 |
Correct |
46 ms |
36036 KB |
Output is correct |
27 |
Correct |
26 ms |
31616 KB |
Output is correct |
28 |
Correct |
22 ms |
31564 KB |
Output is correct |
29 |
Correct |
23 ms |
31520 KB |
Output is correct |
30 |
Correct |
22 ms |
31608 KB |
Output is correct |
31 |
Correct |
21 ms |
31608 KB |
Output is correct |
32 |
Correct |
23 ms |
31596 KB |
Output is correct |
33 |
Correct |
22 ms |
31644 KB |
Output is correct |
34 |
Correct |
22 ms |
31564 KB |
Output is correct |
35 |
Correct |
22 ms |
31564 KB |
Output is correct |
36 |
Correct |
22 ms |
31608 KB |
Output is correct |
37 |
Correct |
23 ms |
31684 KB |
Output is correct |
38 |
Correct |
23 ms |
31664 KB |
Output is correct |
39 |
Correct |
22 ms |
31564 KB |
Output is correct |
40 |
Correct |
24 ms |
31564 KB |
Output is correct |
41 |
Correct |
22 ms |
31680 KB |
Output is correct |
42 |
Correct |
22 ms |
31556 KB |
Output is correct |
43 |
Correct |
24 ms |
31692 KB |
Output is correct |
44 |
Correct |
22 ms |
31564 KB |
Output is correct |
45 |
Correct |
23 ms |
31564 KB |
Output is correct |
46 |
Correct |
22 ms |
31624 KB |
Output is correct |
47 |
Correct |
23 ms |
31564 KB |
Output is correct |
48 |
Correct |
22 ms |
31632 KB |
Output is correct |
49 |
Correct |
22 ms |
31564 KB |
Output is correct |
50 |
Correct |
22 ms |
31564 KB |
Output is correct |
51 |
Correct |
22 ms |
31624 KB |
Output is correct |
52 |
Correct |
22 ms |
31564 KB |
Output is correct |
53 |
Correct |
25 ms |
31616 KB |
Output is correct |
54 |
Correct |
25 ms |
31728 KB |
Output is correct |
55 |
Correct |
23 ms |
31604 KB |
Output is correct |
56 |
Correct |
22 ms |
31708 KB |
Output is correct |
57 |
Correct |
22 ms |
31604 KB |
Output is correct |
58 |
Correct |
24 ms |
31664 KB |
Output is correct |
59 |
Correct |
22 ms |
31612 KB |
Output is correct |
60 |
Correct |
22 ms |
31608 KB |
Output is correct |
61 |
Correct |
23 ms |
31688 KB |
Output is correct |
62 |
Correct |
25 ms |
31676 KB |
Output is correct |
63 |
Correct |
23 ms |
31716 KB |
Output is correct |
64 |
Correct |
23 ms |
31692 KB |
Output is correct |
65 |
Correct |
23 ms |
31588 KB |
Output is correct |
66 |
Correct |
23 ms |
31564 KB |
Output is correct |
67 |
Correct |
24 ms |
31612 KB |
Output is correct |
68 |
Correct |
22 ms |
31564 KB |
Output is correct |
69 |
Correct |
22 ms |
31596 KB |
Output is correct |
70 |
Correct |
23 ms |
31752 KB |
Output is correct |
71 |
Correct |
24 ms |
31816 KB |
Output is correct |
72 |
Correct |
26 ms |
31876 KB |
Output is correct |
73 |
Correct |
24 ms |
31740 KB |
Output is correct |
74 |
Correct |
26 ms |
31864 KB |
Output is correct |
75 |
Correct |
23 ms |
31792 KB |
Output is correct |
76 |
Correct |
47 ms |
34680 KB |
Output is correct |
77 |
Correct |
42 ms |
35112 KB |
Output is correct |
78 |
Correct |
52 ms |
35632 KB |
Output is correct |
79 |
Correct |
23 ms |
31684 KB |
Output is correct |
80 |
Correct |
23 ms |
31564 KB |
Output is correct |
81 |
Correct |
22 ms |
31592 KB |
Output is correct |
82 |
Correct |
23 ms |
31628 KB |
Output is correct |
83 |
Correct |
23 ms |
31692 KB |
Output is correct |
84 |
Correct |
24 ms |
31948 KB |
Output is correct |
85 |
Correct |
24 ms |
31872 KB |
Output is correct |
86 |
Correct |
25 ms |
31948 KB |
Output is correct |
87 |
Correct |
25 ms |
31944 KB |
Output is correct |
88 |
Correct |
24 ms |
31948 KB |
Output is correct |
89 |
Correct |
25 ms |
31876 KB |
Output is correct |
90 |
Correct |
55 ms |
35832 KB |
Output is correct |
91 |
Correct |
56 ms |
35800 KB |
Output is correct |
92 |
Correct |
61 ms |
35880 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
31564 KB |
Output is correct |
2 |
Correct |
22 ms |
31604 KB |
Output is correct |
3 |
Correct |
22 ms |
31564 KB |
Output is correct |
4 |
Correct |
22 ms |
31564 KB |
Output is correct |
5 |
Correct |
23 ms |
31520 KB |
Output is correct |
6 |
Correct |
21 ms |
31564 KB |
Output is correct |
7 |
Correct |
22 ms |
31604 KB |
Output is correct |
8 |
Correct |
21 ms |
31564 KB |
Output is correct |
9 |
Correct |
23 ms |
31564 KB |
Output is correct |
10 |
Correct |
22 ms |
31640 KB |
Output is correct |
11 |
Correct |
22 ms |
31580 KB |
Output is correct |
12 |
Correct |
23 ms |
31596 KB |
Output is correct |
13 |
Correct |
22 ms |
31600 KB |
Output is correct |
14 |
Correct |
23 ms |
31648 KB |
Output is correct |
15 |
Correct |
23 ms |
31692 KB |
Output is correct |
16 |
Correct |
24 ms |
31680 KB |
Output is correct |
17 |
Correct |
23 ms |
31608 KB |
Output is correct |
18 |
Correct |
25 ms |
31700 KB |
Output is correct |
19 |
Correct |
22 ms |
31704 KB |
Output is correct |
20 |
Correct |
24 ms |
31596 KB |
Output is correct |
21 |
Correct |
22 ms |
31612 KB |
Output is correct |
22 |
Correct |
24 ms |
31692 KB |
Output is correct |
23 |
Correct |
24 ms |
31692 KB |
Output is correct |
24 |
Correct |
46 ms |
36048 KB |
Output is correct |
25 |
Correct |
45 ms |
36004 KB |
Output is correct |
26 |
Correct |
46 ms |
36036 KB |
Output is correct |
27 |
Correct |
25 ms |
32032 KB |
Output is correct |
28 |
Correct |
27 ms |
31948 KB |
Output is correct |
29 |
Correct |
28 ms |
32064 KB |
Output is correct |
30 |
Correct |
26 ms |
31948 KB |
Output is correct |
31 |
Correct |
26 ms |
31936 KB |
Output is correct |
32 |
Correct |
26 ms |
31944 KB |
Output is correct |
33 |
Correct |
38 ms |
33220 KB |
Output is correct |
34 |
Correct |
38 ms |
33216 KB |
Output is correct |
35 |
Correct |
40 ms |
33268 KB |
Output is correct |
36 |
Correct |
42 ms |
33228 KB |
Output is correct |
37 |
Correct |
37 ms |
33228 KB |
Output is correct |
38 |
Correct |
38 ms |
33188 KB |
Output is correct |
39 |
Correct |
65 ms |
36660 KB |
Output is correct |
40 |
Correct |
63 ms |
36728 KB |
Output is correct |
41 |
Correct |
59 ms |
36676 KB |
Output is correct |
42 |
Correct |
26 ms |
31616 KB |
Output is correct |
43 |
Correct |
22 ms |
31564 KB |
Output is correct |
44 |
Correct |
23 ms |
31520 KB |
Output is correct |
45 |
Correct |
22 ms |
31608 KB |
Output is correct |
46 |
Correct |
21 ms |
31608 KB |
Output is correct |
47 |
Correct |
23 ms |
31596 KB |
Output is correct |
48 |
Correct |
22 ms |
31644 KB |
Output is correct |
49 |
Correct |
22 ms |
31564 KB |
Output is correct |
50 |
Correct |
22 ms |
31564 KB |
Output is correct |
51 |
Correct |
22 ms |
31608 KB |
Output is correct |
52 |
Correct |
23 ms |
31684 KB |
Output is correct |
53 |
Correct |
23 ms |
31664 KB |
Output is correct |
54 |
Correct |
22 ms |
31564 KB |
Output is correct |
55 |
Correct |
24 ms |
31564 KB |
Output is correct |
56 |
Correct |
22 ms |
31680 KB |
Output is correct |
57 |
Correct |
22 ms |
31556 KB |
Output is correct |
58 |
Correct |
24 ms |
31692 KB |
Output is correct |
59 |
Correct |
22 ms |
31564 KB |
Output is correct |
60 |
Correct |
23 ms |
31564 KB |
Output is correct |
61 |
Correct |
22 ms |
31624 KB |
Output is correct |
62 |
Correct |
23 ms |
31564 KB |
Output is correct |
63 |
Correct |
22 ms |
31632 KB |
Output is correct |
64 |
Correct |
22 ms |
31564 KB |
Output is correct |
65 |
Correct |
22 ms |
31564 KB |
Output is correct |
66 |
Correct |
22 ms |
31624 KB |
Output is correct |
67 |
Correct |
22 ms |
31564 KB |
Output is correct |
68 |
Correct |
25 ms |
31616 KB |
Output is correct |
69 |
Correct |
25 ms |
31728 KB |
Output is correct |
70 |
Correct |
23 ms |
31604 KB |
Output is correct |
71 |
Correct |
22 ms |
31708 KB |
Output is correct |
72 |
Correct |
22 ms |
31604 KB |
Output is correct |
73 |
Correct |
24 ms |
31664 KB |
Output is correct |
74 |
Correct |
22 ms |
31612 KB |
Output is correct |
75 |
Correct |
22 ms |
31608 KB |
Output is correct |
76 |
Correct |
23 ms |
31688 KB |
Output is correct |
77 |
Correct |
25 ms |
31676 KB |
Output is correct |
78 |
Correct |
23 ms |
31716 KB |
Output is correct |
79 |
Correct |
23 ms |
31692 KB |
Output is correct |
80 |
Correct |
23 ms |
31588 KB |
Output is correct |
81 |
Correct |
23 ms |
31564 KB |
Output is correct |
82 |
Correct |
24 ms |
31612 KB |
Output is correct |
83 |
Correct |
22 ms |
31564 KB |
Output is correct |
84 |
Correct |
22 ms |
31596 KB |
Output is correct |
85 |
Correct |
23 ms |
31752 KB |
Output is correct |
86 |
Correct |
24 ms |
31816 KB |
Output is correct |
87 |
Correct |
26 ms |
31876 KB |
Output is correct |
88 |
Correct |
24 ms |
31740 KB |
Output is correct |
89 |
Correct |
26 ms |
31864 KB |
Output is correct |
90 |
Correct |
23 ms |
31792 KB |
Output is correct |
91 |
Correct |
47 ms |
34680 KB |
Output is correct |
92 |
Correct |
42 ms |
35112 KB |
Output is correct |
93 |
Correct |
52 ms |
35632 KB |
Output is correct |
94 |
Correct |
23 ms |
31684 KB |
Output is correct |
95 |
Correct |
23 ms |
31564 KB |
Output is correct |
96 |
Correct |
22 ms |
31592 KB |
Output is correct |
97 |
Correct |
23 ms |
31628 KB |
Output is correct |
98 |
Correct |
23 ms |
31692 KB |
Output is correct |
99 |
Correct |
24 ms |
31948 KB |
Output is correct |
100 |
Correct |
24 ms |
31872 KB |
Output is correct |
101 |
Correct |
25 ms |
31948 KB |
Output is correct |
102 |
Correct |
25 ms |
31944 KB |
Output is correct |
103 |
Correct |
24 ms |
31948 KB |
Output is correct |
104 |
Correct |
25 ms |
31876 KB |
Output is correct |
105 |
Correct |
55 ms |
35832 KB |
Output is correct |
106 |
Correct |
56 ms |
35800 KB |
Output is correct |
107 |
Correct |
61 ms |
35880 KB |
Output is correct |
108 |
Correct |
25 ms |
31968 KB |
Output is correct |
109 |
Correct |
75 ms |
31984 KB |
Output is correct |
110 |
Correct |
70 ms |
31948 KB |
Output is correct |
111 |
Correct |
59 ms |
31992 KB |
Output is correct |
112 |
Correct |
68 ms |
31996 KB |
Output is correct |
113 |
Correct |
52 ms |
31980 KB |
Output is correct |
114 |
Correct |
39 ms |
33400 KB |
Output is correct |
115 |
Correct |
39 ms |
33224 KB |
Output is correct |
116 |
Correct |
45 ms |
33632 KB |
Output is correct |
117 |
Correct |
40 ms |
33340 KB |
Output is correct |
118 |
Correct |
41 ms |
33440 KB |
Output is correct |
119 |
Correct |
37 ms |
33220 KB |
Output is correct |
120 |
Correct |
50 ms |
34804 KB |
Output is correct |
121 |
Correct |
30 ms |
32500 KB |
Output is correct |
122 |
Correct |
52 ms |
34948 KB |
Output is correct |
123 |
Correct |
29 ms |
32324 KB |
Output is correct |
124 |
Correct |
55 ms |
35444 KB |
Output is correct |
125 |
Correct |
33 ms |
32696 KB |
Output is correct |
126 |
Correct |
33 ms |
32764 KB |
Output is correct |
127 |
Correct |
38 ms |
33016 KB |
Output is correct |
128 |
Correct |
33 ms |
32708 KB |
Output is correct |
129 |
Correct |
35 ms |
32632 KB |
Output is correct |
130 |
Correct |
26 ms |
31948 KB |
Output is correct |
131 |
Correct |
98 ms |
32160 KB |
Output is correct |
132 |
Correct |
108 ms |
32192 KB |
Output is correct |
133 |
Correct |
100 ms |
32196 KB |
Output is correct |
134 |
Correct |
93 ms |
32356 KB |
Output is correct |
135 |
Correct |
83 ms |
32356 KB |
Output is correct |
136 |
Correct |
51 ms |
34040 KB |
Output is correct |
137 |
Correct |
48 ms |
34112 KB |
Output is correct |
138 |
Correct |
48 ms |
34068 KB |
Output is correct |
139 |
Correct |
48 ms |
34152 KB |
Output is correct |
140 |
Correct |
48 ms |
34040 KB |
Output is correct |
141 |
Correct |
49 ms |
34116 KB |
Output is correct |
142 |
Correct |
72 ms |
36676 KB |
Output is correct |
143 |
Correct |
37 ms |
33012 KB |
Output is correct |
144 |
Correct |
67 ms |
36588 KB |
Output is correct |
145 |
Correct |
36 ms |
32948 KB |
Output is correct |
146 |
Correct |
69 ms |
36676 KB |
Output is correct |
147 |
Correct |
35 ms |
32972 KB |
Output is correct |
148 |
Correct |
40 ms |
33476 KB |
Output is correct |
149 |
Correct |
43 ms |
33244 KB |
Output is correct |
150 |
Correct |
39 ms |
33220 KB |
Output is correct |
151 |
Correct |
38 ms |
33100 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
21 ms |
31564 KB |
Output is correct |
2 |
Correct |
22 ms |
31604 KB |
Output is correct |
3 |
Correct |
22 ms |
31564 KB |
Output is correct |
4 |
Correct |
22 ms |
31564 KB |
Output is correct |
5 |
Correct |
23 ms |
31520 KB |
Output is correct |
6 |
Correct |
21 ms |
31564 KB |
Output is correct |
7 |
Correct |
22 ms |
31604 KB |
Output is correct |
8 |
Correct |
21 ms |
31564 KB |
Output is correct |
9 |
Correct |
23 ms |
31564 KB |
Output is correct |
10 |
Correct |
22 ms |
31640 KB |
Output is correct |
11 |
Correct |
22 ms |
31580 KB |
Output is correct |
12 |
Correct |
23 ms |
31596 KB |
Output is correct |
13 |
Correct |
22 ms |
31600 KB |
Output is correct |
14 |
Correct |
23 ms |
31648 KB |
Output is correct |
15 |
Correct |
23 ms |
31692 KB |
Output is correct |
16 |
Correct |
24 ms |
31680 KB |
Output is correct |
17 |
Correct |
23 ms |
31608 KB |
Output is correct |
18 |
Correct |
25 ms |
31700 KB |
Output is correct |
19 |
Correct |
22 ms |
31704 KB |
Output is correct |
20 |
Correct |
24 ms |
31596 KB |
Output is correct |
21 |
Correct |
22 ms |
31612 KB |
Output is correct |
22 |
Correct |
24 ms |
31692 KB |
Output is correct |
23 |
Correct |
24 ms |
31692 KB |
Output is correct |
24 |
Correct |
46 ms |
36048 KB |
Output is correct |
25 |
Correct |
45 ms |
36004 KB |
Output is correct |
26 |
Correct |
46 ms |
36036 KB |
Output is correct |
27 |
Correct |
25 ms |
32032 KB |
Output is correct |
28 |
Correct |
27 ms |
31948 KB |
Output is correct |
29 |
Correct |
28 ms |
32064 KB |
Output is correct |
30 |
Correct |
26 ms |
31948 KB |
Output is correct |
31 |
Correct |
26 ms |
31936 KB |
Output is correct |
32 |
Correct |
26 ms |
31944 KB |
Output is correct |
33 |
Correct |
38 ms |
33220 KB |
Output is correct |
34 |
Correct |
38 ms |
33216 KB |
Output is correct |
35 |
Correct |
40 ms |
33268 KB |
Output is correct |
36 |
Correct |
42 ms |
33228 KB |
Output is correct |
37 |
Correct |
37 ms |
33228 KB |
Output is correct |
38 |
Correct |
38 ms |
33188 KB |
Output is correct |
39 |
Correct |
65 ms |
36660 KB |
Output is correct |
40 |
Correct |
63 ms |
36728 KB |
Output is correct |
41 |
Correct |
59 ms |
36676 KB |
Output is correct |
42 |
Correct |
37 ms |
33528 KB |
Output is correct |
43 |
Correct |
31 ms |
32756 KB |
Output is correct |
44 |
Correct |
42 ms |
33716 KB |
Output is correct |
45 |
Correct |
41 ms |
32972 KB |
Output is correct |
46 |
Correct |
33 ms |
32900 KB |
Output is correct |
47 |
Correct |
42 ms |
33716 KB |
Output is correct |
48 |
Correct |
111 ms |
45624 KB |
Output is correct |
49 |
Correct |
76 ms |
39516 KB |
Output is correct |
50 |
Correct |
85 ms |
43580 KB |
Output is correct |
51 |
Correct |
99 ms |
43204 KB |
Output is correct |
52 |
Correct |
103 ms |
42632 KB |
Output is correct |
53 |
Correct |
90 ms |
39428 KB |
Output is correct |
54 |
Correct |
38 ms |
33736 KB |
Output is correct |
55 |
Correct |
38 ms |
33868 KB |
Output is correct |
56 |
Correct |
41 ms |
33784 KB |
Output is correct |
57 |
Correct |
41 ms |
33784 KB |
Output is correct |
58 |
Correct |
41 ms |
33656 KB |
Output is correct |
59 |
Correct |
42 ms |
33732 KB |
Output is correct |
60 |
Correct |
121 ms |
46560 KB |
Output is correct |
61 |
Correct |
119 ms |
46548 KB |
Output is correct |
62 |
Correct |
120 ms |
46536 KB |
Output is correct |
63 |
Correct |
123 ms |
46568 KB |
Output is correct |
64 |
Correct |
124 ms |
46716 KB |
Output is correct |
65 |
Correct |
127 ms |
46560 KB |
Output is correct |
66 |
Correct |
136 ms |
45444 KB |
Output is correct |
67 |
Correct |
138 ms |
45304 KB |
Output is correct |
68 |
Correct |
142 ms |
45304 KB |
Output is correct |
69 |
Correct |
26 ms |
31616 KB |
Output is correct |
70 |
Correct |
22 ms |
31564 KB |
Output is correct |
71 |
Correct |
23 ms |
31520 KB |
Output is correct |
72 |
Correct |
22 ms |
31608 KB |
Output is correct |
73 |
Correct |
21 ms |
31608 KB |
Output is correct |
74 |
Correct |
23 ms |
31596 KB |
Output is correct |
75 |
Correct |
22 ms |
31644 KB |
Output is correct |
76 |
Correct |
22 ms |
31564 KB |
Output is correct |
77 |
Correct |
22 ms |
31564 KB |
Output is correct |
78 |
Correct |
22 ms |
31608 KB |
Output is correct |
79 |
Correct |
23 ms |
31684 KB |
Output is correct |
80 |
Correct |
23 ms |
31664 KB |
Output is correct |
81 |
Correct |
22 ms |
31564 KB |
Output is correct |
82 |
Correct |
24 ms |
31564 KB |
Output is correct |
83 |
Correct |
22 ms |
31680 KB |
Output is correct |
84 |
Correct |
22 ms |
31556 KB |
Output is correct |
85 |
Correct |
24 ms |
31692 KB |
Output is correct |
86 |
Correct |
22 ms |
31564 KB |
Output is correct |
87 |
Correct |
23 ms |
31564 KB |
Output is correct |
88 |
Correct |
22 ms |
31624 KB |
Output is correct |
89 |
Correct |
23 ms |
31564 KB |
Output is correct |
90 |
Correct |
22 ms |
31632 KB |
Output is correct |
91 |
Correct |
22 ms |
31564 KB |
Output is correct |
92 |
Correct |
22 ms |
31564 KB |
Output is correct |
93 |
Correct |
22 ms |
31624 KB |
Output is correct |
94 |
Correct |
22 ms |
31564 KB |
Output is correct |
95 |
Correct |
25 ms |
31616 KB |
Output is correct |
96 |
Correct |
25 ms |
31728 KB |
Output is correct |
97 |
Correct |
23 ms |
31604 KB |
Output is correct |
98 |
Correct |
22 ms |
31708 KB |
Output is correct |
99 |
Correct |
22 ms |
31604 KB |
Output is correct |
100 |
Correct |
24 ms |
31664 KB |
Output is correct |
101 |
Correct |
22 ms |
31612 KB |
Output is correct |
102 |
Correct |
22 ms |
31608 KB |
Output is correct |
103 |
Correct |
23 ms |
31688 KB |
Output is correct |
104 |
Correct |
25 ms |
31676 KB |
Output is correct |
105 |
Correct |
23 ms |
31716 KB |
Output is correct |
106 |
Correct |
23 ms |
31692 KB |
Output is correct |
107 |
Correct |
23 ms |
31588 KB |
Output is correct |
108 |
Correct |
23 ms |
31564 KB |
Output is correct |
109 |
Correct |
24 ms |
31612 KB |
Output is correct |
110 |
Correct |
22 ms |
31564 KB |
Output is correct |
111 |
Correct |
22 ms |
31596 KB |
Output is correct |
112 |
Correct |
23 ms |
31752 KB |
Output is correct |
113 |
Correct |
24 ms |
31816 KB |
Output is correct |
114 |
Correct |
26 ms |
31876 KB |
Output is correct |
115 |
Correct |
24 ms |
31740 KB |
Output is correct |
116 |
Correct |
26 ms |
31864 KB |
Output is correct |
117 |
Correct |
23 ms |
31792 KB |
Output is correct |
118 |
Correct |
47 ms |
34680 KB |
Output is correct |
119 |
Correct |
42 ms |
35112 KB |
Output is correct |
120 |
Correct |
52 ms |
35632 KB |
Output is correct |
121 |
Correct |
23 ms |
31684 KB |
Output is correct |
122 |
Correct |
23 ms |
31564 KB |
Output is correct |
123 |
Correct |
22 ms |
31592 KB |
Output is correct |
124 |
Correct |
23 ms |
31628 KB |
Output is correct |
125 |
Correct |
23 ms |
31692 KB |
Output is correct |
126 |
Correct |
24 ms |
31948 KB |
Output is correct |
127 |
Correct |
24 ms |
31872 KB |
Output is correct |
128 |
Correct |
25 ms |
31948 KB |
Output is correct |
129 |
Correct |
25 ms |
31944 KB |
Output is correct |
130 |
Correct |
24 ms |
31948 KB |
Output is correct |
131 |
Correct |
25 ms |
31876 KB |
Output is correct |
132 |
Correct |
55 ms |
35832 KB |
Output is correct |
133 |
Correct |
56 ms |
35800 KB |
Output is correct |
134 |
Correct |
61 ms |
35880 KB |
Output is correct |
135 |
Correct |
25 ms |
31968 KB |
Output is correct |
136 |
Correct |
75 ms |
31984 KB |
Output is correct |
137 |
Correct |
70 ms |
31948 KB |
Output is correct |
138 |
Correct |
59 ms |
31992 KB |
Output is correct |
139 |
Correct |
68 ms |
31996 KB |
Output is correct |
140 |
Correct |
52 ms |
31980 KB |
Output is correct |
141 |
Correct |
39 ms |
33400 KB |
Output is correct |
142 |
Correct |
39 ms |
33224 KB |
Output is correct |
143 |
Correct |
45 ms |
33632 KB |
Output is correct |
144 |
Correct |
40 ms |
33340 KB |
Output is correct |
145 |
Correct |
41 ms |
33440 KB |
Output is correct |
146 |
Correct |
37 ms |
33220 KB |
Output is correct |
147 |
Correct |
50 ms |
34804 KB |
Output is correct |
148 |
Correct |
30 ms |
32500 KB |
Output is correct |
149 |
Correct |
52 ms |
34948 KB |
Output is correct |
150 |
Correct |
29 ms |
32324 KB |
Output is correct |
151 |
Correct |
55 ms |
35444 KB |
Output is correct |
152 |
Correct |
33 ms |
32696 KB |
Output is correct |
153 |
Correct |
33 ms |
32764 KB |
Output is correct |
154 |
Correct |
38 ms |
33016 KB |
Output is correct |
155 |
Correct |
33 ms |
32708 KB |
Output is correct |
156 |
Correct |
35 ms |
32632 KB |
Output is correct |
157 |
Correct |
26 ms |
31948 KB |
Output is correct |
158 |
Correct |
98 ms |
32160 KB |
Output is correct |
159 |
Correct |
108 ms |
32192 KB |
Output is correct |
160 |
Correct |
100 ms |
32196 KB |
Output is correct |
161 |
Correct |
93 ms |
32356 KB |
Output is correct |
162 |
Correct |
83 ms |
32356 KB |
Output is correct |
163 |
Correct |
51 ms |
34040 KB |
Output is correct |
164 |
Correct |
48 ms |
34112 KB |
Output is correct |
165 |
Correct |
48 ms |
34068 KB |
Output is correct |
166 |
Correct |
48 ms |
34152 KB |
Output is correct |
167 |
Correct |
48 ms |
34040 KB |
Output is correct |
168 |
Correct |
49 ms |
34116 KB |
Output is correct |
169 |
Correct |
72 ms |
36676 KB |
Output is correct |
170 |
Correct |
37 ms |
33012 KB |
Output is correct |
171 |
Correct |
67 ms |
36588 KB |
Output is correct |
172 |
Correct |
36 ms |
32948 KB |
Output is correct |
173 |
Correct |
69 ms |
36676 KB |
Output is correct |
174 |
Correct |
35 ms |
32972 KB |
Output is correct |
175 |
Correct |
40 ms |
33476 KB |
Output is correct |
176 |
Correct |
43 ms |
33244 KB |
Output is correct |
177 |
Correct |
39 ms |
33220 KB |
Output is correct |
178 |
Correct |
38 ms |
33100 KB |
Output is correct |
179 |
Correct |
33 ms |
32972 KB |
Output is correct |
180 |
Correct |
171 ms |
32840 KB |
Output is correct |
181 |
Correct |
290 ms |
33456 KB |
Output is correct |
182 |
Correct |
414 ms |
33860 KB |
Output is correct |
183 |
Correct |
201 ms |
33224 KB |
Output is correct |
184 |
Correct |
164 ms |
33108 KB |
Output is correct |
185 |
Correct |
69 ms |
36676 KB |
Output is correct |
186 |
Correct |
76 ms |
39364 KB |
Output is correct |
187 |
Correct |
81 ms |
37704 KB |
Output is correct |
188 |
Correct |
87 ms |
37292 KB |
Output is correct |
189 |
Correct |
82 ms |
37188 KB |
Output is correct |
190 |
Correct |
101 ms |
39364 KB |
Output is correct |
191 |
Correct |
92 ms |
38916 KB |
Output is correct |
192 |
Correct |
69 ms |
36244 KB |
Output is correct |
193 |
Correct |
64 ms |
35524 KB |
Output is correct |
194 |
Correct |
41 ms |
33728 KB |
Output is correct |
195 |
Correct |
391 ms |
33860 KB |
Output is correct |
196 |
Correct |
450 ms |
34032 KB |
Output is correct |
197 |
Correct |
411 ms |
34116 KB |
Output is correct |
198 |
Correct |
346 ms |
33984 KB |
Output is correct |
199 |
Correct |
304 ms |
34060 KB |
Output is correct |
200 |
Correct |
157 ms |
47984 KB |
Output is correct |
201 |
Correct |
148 ms |
47804 KB |
Output is correct |
202 |
Correct |
153 ms |
47864 KB |
Output is correct |
203 |
Correct |
148 ms |
47812 KB |
Output is correct |
204 |
Correct |
149 ms |
47868 KB |
Output is correct |
205 |
Correct |
153 ms |
47904 KB |
Output is correct |
206 |
Correct |
145 ms |
46672 KB |
Output is correct |
207 |
Correct |
136 ms |
46200 KB |
Output is correct |
208 |
Correct |
146 ms |
46660 KB |
Output is correct |
209 |
Correct |
136 ms |
46148 KB |
Output is correct |
210 |
Correct |
145 ms |
46704 KB |
Output is correct |
211 |
Correct |
138 ms |
46148 KB |
Output is correct |
212 |
Correct |
133 ms |
47596 KB |
Output is correct |
213 |
Correct |
128 ms |
42784 KB |
Output is correct |
214 |
Correct |
123 ms |
41796 KB |
Output is correct |
215 |
Correct |
132 ms |
41324 KB |
Output is correct |