#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(v) v.begin(), v.end()
#define endl '\n'
#define pl(var) " [" << #var << ": " << (var) << "] "
template<typename A, typename B> ostream& operator<<(ostream &cout, pair<A, B> const &p) { return cout << "[" << p.first << ", " << p.second << "]"; }
template<typename A> ostream& operator<<(ostream &cout, vector<A> const &v) { cout << "["; for(int i = 0; i < (int)v.size(); i++) {if (i) cout << ", "; cout << v[i];} return cout << "]";}
template<typename A, typename B> istream& operator>>(istream& cin, pair<A, B> &p) { cin >> p.first; return cin >> p.second; }
struct Seg_tree {
vector<ll int> tree;
int array_size;
int tree_size;
ll int def = 1e9;
void init(int n) {
array_size = n;
while (__builtin_popcount(array_size) != 1) {
array_size++;
}
tree_size = 2 * array_size - 1;
tree = vector<ll int>(tree_size, def);
}
ll int comb(ll int a, ll int b) {
return min(a, b);
}
void pull(int u) {
tree[u] = comb(tree[2 * u + 1], tree[2 * u + 2]);
}
void update(int idx, ll int val) {
return update_dfs(0, idx, val, 0, array_size - 1);
}
void update_dfs(int u, int idx, ll int val, int node_left, int node_right) {
if (node_right == node_left) {
assert(idx == node_left);
tree[u] = val;
return;
}
ll int mid = (node_right + node_left) / 2;
if (idx <= mid) {
update_dfs(2 * u + 1, idx, val, node_left, mid);
} else {
update_dfs(2 * u + 2, idx, val, mid + 1, node_right);
}
pull(u);
}
ll int query(int l, int r) {
// sum from x+1 to n
return query_dfs(0, l, r, 0, array_size - 1);
}
ll int query_dfs(int u, int q_left, int q_right, int node_left, int node_right) {
pair<int, int> q = make_pair(q_left, q_right);
if (!intersects(q, make_pair(node_left, node_right))) return 0;
if (q_left <= node_left && node_right <= q_right) {
return tree[u];
}
int mid = (node_right + node_left) / 2;
ll int res = def;
if (intersects(q, make_pair(node_left, mid))) {
res = comb(res, query_dfs(2 * u + 1, q_left, q_right, node_left, mid));
} if (intersects(q, make_pair(mid + 1, node_right))) {
res = comb(res, query_dfs(2 * u + 2, q_left, q_right, mid + 1, node_right));
}
return res;
}
bool intersects(pair<int, int> a, pair<int, int> b) {
if (a.first > b.first) swap(a, b);
return a.second >= b.first;
}
void print() {
cout << " [";
for (int i = 0; i < array_size; i++) {
cout << tree[array_size + i - 1] << ' ';
}
cout << "] " << endl;
}
};
int minimumInstructions(int n, int m, int k, vector<int> c, vector<int> a, vector<vector<int>> b) {
// dp[i] = min instructions that he has to give to paint the ith prefix
{
bool one = 1;
vector<int> converted(n);
vector<int> contractor(k, -1);
for (int i = 0; i < m; i++) {
for (int j : b[i]) {
if (contractor[j] != -1) {
one = 0;
break;
}
contractor[j] = i;
}
}
if (one) {
for (int i = 0; i < n; i++) {
converted[i] = contractor[c[i]];
if (converted[i] == -1) return -1;
}
vector<int> dp(n + 1, 1e9);
dp[0] = 0;
Seg_tree tree;
tree.init(n + 1);
tree.update(0, 0);
auto check = [&](int en) -> int {
en--;
for (int i = en - m + 1; i < en; i++) {
if ((converted[i] + 1) % m != converted[i + 1]) {
return 1e9;
}
}
return 1;
};
for (int i = m; i <= n; i++) {
dp[i] = min({
dp[i],
(int)tree.query(i - m, i - 1) + check(i)
});
tree.update(i, dp[i]);
}
return dp[n] == 1e9 ? -1 : dp[n];
}
}
vector<int> dp(n + 1, 1e9);
Seg_tree tree;
tree.init(n + 1);
tree.update(0, 0);
dp[0] = 0;
vector<vector<bool>> possible(n, vector<bool>(k));
for (int i = 0; i < m; i++) {
for (int j = 0; j < a[i]; j++) {
possible[i][b[i][j]] = 1;
}
}
auto cost = [&](int en) -> int {
// possible to paint en - m + 1 .. en
en--;
vector<int> seg;
for (int i = en - m + 1; i <= en; i++) {
seg.push_back(c[i]);
}
assert((int)seg.size() == m);
for (int i = 0; i < m; i++) {
seg.push_back(seg[i]);
}
for (int start = 0; start < (int)seg.size(); start++) {
if (start + m - 1 >= (int)seg.size()) break;
bool ok = 1;
for (int i = 0; i < m; i++) {
if (!possible[i][seg[start + i]]) {
ok = 0;
break;
}
}
if (ok) return 1;
}
return 1e9;
};
for (int i = m; i <= n; i++) {
dp[i] = min({
dp[i],
(int)tree.query(i - m, i - 1) + cost(i)
});
tree.update(i, dp[i]);
}
if (dp[n] == 1e9) return -1;
return dp[n];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
296 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
224 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
724 KB |
Output is correct |
14 |
Correct |
2 ms |
724 KB |
Output is correct |
15 |
Correct |
1 ms |
724 KB |
Output is correct |
16 |
Correct |
1 ms |
688 KB |
Output is correct |
17 |
Correct |
1 ms |
724 KB |
Output is correct |
18 |
Correct |
1 ms |
688 KB |
Output is correct |
19 |
Correct |
1 ms |
724 KB |
Output is correct |
20 |
Correct |
1 ms |
724 KB |
Output is correct |
21 |
Correct |
1 ms |
724 KB |
Output is correct |
22 |
Correct |
11 ms |
2020 KB |
Output is correct |
23 |
Correct |
14 ms |
1992 KB |
Output is correct |
24 |
Correct |
18 ms |
2088 KB |
Output is correct |
25 |
Correct |
9 ms |
1108 KB |
Output is correct |
26 |
Correct |
7 ms |
1084 KB |
Output is correct |
27 |
Correct |
7 ms |
1080 KB |
Output is correct |
28 |
Correct |
7 ms |
1108 KB |
Output is correct |
29 |
Correct |
6 ms |
1108 KB |
Output is correct |
30 |
Correct |
6 ms |
1064 KB |
Output is correct |
31 |
Correct |
181 ms |
2044 KB |
Output is correct |
32 |
Correct |
194 ms |
2004 KB |
Output is correct |
33 |
Correct |
197 ms |
2048 KB |
Output is correct |
34 |
Correct |
183 ms |
2004 KB |
Output is correct |
35 |
Correct |
194 ms |
2040 KB |
Output is correct |
36 |
Correct |
207 ms |
2016 KB |
Output is correct |
37 |
Correct |
17 ms |
3148 KB |
Output is correct |
38 |
Correct |
18 ms |
3116 KB |
Output is correct |
39 |
Correct |
17 ms |
3124 KB |
Output is correct |
40 |
Correct |
23 ms |
3924 KB |
Output is correct |
41 |
Correct |
16 ms |
2260 KB |
Output is correct |
42 |
Correct |
30 ms |
4020 KB |
Output is correct |
43 |
Correct |
21 ms |
2484 KB |
Output is correct |
44 |
Correct |
24 ms |
2388 KB |
Output is correct |
45 |
Correct |
31 ms |
4216 KB |
Output is correct |
46 |
Execution timed out |
1572 ms |
10804 KB |
Time limit exceeded |
47 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
296 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
296 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
224 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
724 KB |
Output is correct |
14 |
Correct |
2 ms |
724 KB |
Output is correct |
15 |
Correct |
1 ms |
724 KB |
Output is correct |
16 |
Correct |
1 ms |
688 KB |
Output is correct |
17 |
Correct |
1 ms |
724 KB |
Output is correct |
18 |
Correct |
1 ms |
688 KB |
Output is correct |
19 |
Correct |
1 ms |
724 KB |
Output is correct |
20 |
Correct |
1 ms |
724 KB |
Output is correct |
21 |
Correct |
1 ms |
724 KB |
Output is correct |
22 |
Correct |
1 ms |
212 KB |
Output is correct |
23 |
Correct |
1 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
1 ms |
212 KB |
Output is correct |
26 |
Correct |
1 ms |
212 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
340 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
212 KB |
Output is correct |
33 |
Correct |
3 ms |
4612 KB |
Output is correct |
34 |
Correct |
3 ms |
3672 KB |
Output is correct |
35 |
Correct |
2 ms |
2296 KB |
Output is correct |
36 |
Correct |
4 ms |
4820 KB |
Output is correct |
37 |
Correct |
3 ms |
3484 KB |
Output is correct |
38 |
Correct |
2 ms |
3584 KB |
Output is correct |
39 |
Correct |
1 ms |
212 KB |
Output is correct |
40 |
Correct |
2 ms |
3244 KB |
Output is correct |
41 |
Correct |
1 ms |
340 KB |
Output is correct |
42 |
Correct |
3 ms |
5216 KB |
Output is correct |
43 |
Correct |
2 ms |
3820 KB |
Output is correct |
44 |
Correct |
1 ms |
340 KB |
Output is correct |
45 |
Correct |
1 ms |
340 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
2 ms |
340 KB |
Output is correct |
48 |
Correct |
1 ms |
340 KB |
Output is correct |
49 |
Correct |
1 ms |
340 KB |
Output is correct |
50 |
Correct |
4 ms |
6476 KB |
Output is correct |
51 |
Correct |
4 ms |
6476 KB |
Output is correct |
52 |
Correct |
4 ms |
6476 KB |
Output is correct |
53 |
Correct |
4 ms |
6476 KB |
Output is correct |
54 |
Correct |
4 ms |
6476 KB |
Output is correct |
55 |
Correct |
5 ms |
6476 KB |
Output is correct |
56 |
Correct |
4 ms |
6476 KB |
Output is correct |
57 |
Correct |
1 ms |
340 KB |
Output is correct |
58 |
Correct |
4 ms |
6476 KB |
Output is correct |
59 |
Correct |
1 ms |
340 KB |
Output is correct |
60 |
Correct |
4 ms |
6476 KB |
Output is correct |
61 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
296 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
224 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
724 KB |
Output is correct |
16 |
Correct |
2 ms |
724 KB |
Output is correct |
17 |
Correct |
1 ms |
724 KB |
Output is correct |
18 |
Correct |
1 ms |
688 KB |
Output is correct |
19 |
Correct |
1 ms |
724 KB |
Output is correct |
20 |
Correct |
1 ms |
688 KB |
Output is correct |
21 |
Correct |
1 ms |
724 KB |
Output is correct |
22 |
Correct |
1 ms |
724 KB |
Output is correct |
23 |
Correct |
1 ms |
724 KB |
Output is correct |
24 |
Correct |
11 ms |
2020 KB |
Output is correct |
25 |
Correct |
14 ms |
1992 KB |
Output is correct |
26 |
Correct |
18 ms |
2088 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
212 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
0 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
212 KB |
Output is correct |
36 |
Correct |
3 ms |
4612 KB |
Output is correct |
37 |
Correct |
3 ms |
3672 KB |
Output is correct |
38 |
Correct |
2 ms |
2296 KB |
Output is correct |
39 |
Correct |
4 ms |
4820 KB |
Output is correct |
40 |
Correct |
3 ms |
3484 KB |
Output is correct |
41 |
Correct |
2 ms |
3584 KB |
Output is correct |
42 |
Correct |
1 ms |
212 KB |
Output is correct |
43 |
Correct |
2 ms |
3244 KB |
Output is correct |
44 |
Correct |
1 ms |
340 KB |
Output is correct |
45 |
Correct |
3 ms |
5216 KB |
Output is correct |
46 |
Correct |
2 ms |
3820 KB |
Output is correct |
47 |
Correct |
1 ms |
340 KB |
Output is correct |
48 |
Correct |
1 ms |
340 KB |
Output is correct |
49 |
Correct |
1 ms |
340 KB |
Output is correct |
50 |
Correct |
2 ms |
340 KB |
Output is correct |
51 |
Correct |
1 ms |
340 KB |
Output is correct |
52 |
Correct |
1 ms |
340 KB |
Output is correct |
53 |
Correct |
4 ms |
6476 KB |
Output is correct |
54 |
Correct |
4 ms |
6476 KB |
Output is correct |
55 |
Correct |
4 ms |
6476 KB |
Output is correct |
56 |
Correct |
4 ms |
6476 KB |
Output is correct |
57 |
Correct |
4 ms |
6476 KB |
Output is correct |
58 |
Correct |
5 ms |
6476 KB |
Output is correct |
59 |
Correct |
4 ms |
6476 KB |
Output is correct |
60 |
Correct |
1 ms |
340 KB |
Output is correct |
61 |
Correct |
4 ms |
6476 KB |
Output is correct |
62 |
Correct |
1 ms |
340 KB |
Output is correct |
63 |
Correct |
4 ms |
6476 KB |
Output is correct |
64 |
Correct |
1 ms |
340 KB |
Output is correct |
65 |
Correct |
1 ms |
340 KB |
Output is correct |
66 |
Correct |
1 ms |
340 KB |
Output is correct |
67 |
Correct |
1 ms |
340 KB |
Output is correct |
68 |
Correct |
1 ms |
340 KB |
Output is correct |
69 |
Correct |
1 ms |
340 KB |
Output is correct |
70 |
Correct |
4 ms |
4872 KB |
Output is correct |
71 |
Correct |
4 ms |
3908 KB |
Output is correct |
72 |
Correct |
3 ms |
3304 KB |
Output is correct |
73 |
Correct |
3 ms |
3648 KB |
Output is correct |
74 |
Correct |
3 ms |
3612 KB |
Output is correct |
75 |
Correct |
5 ms |
4436 KB |
Output is correct |
76 |
Correct |
11 ms |
3648 KB |
Output is correct |
77 |
Correct |
14 ms |
4936 KB |
Output is correct |
78 |
Correct |
15 ms |
5464 KB |
Output is correct |
79 |
Correct |
1 ms |
340 KB |
Output is correct |
80 |
Correct |
2 ms |
340 KB |
Output is correct |
81 |
Correct |
1 ms |
340 KB |
Output is correct |
82 |
Correct |
1 ms |
340 KB |
Output is correct |
83 |
Correct |
1 ms |
340 KB |
Output is correct |
84 |
Correct |
6 ms |
6476 KB |
Output is correct |
85 |
Correct |
6 ms |
6476 KB |
Output is correct |
86 |
Correct |
5 ms |
6580 KB |
Output is correct |
87 |
Correct |
5 ms |
6476 KB |
Output is correct |
88 |
Correct |
5 ms |
6476 KB |
Output is correct |
89 |
Correct |
6 ms |
6476 KB |
Output is correct |
90 |
Correct |
17 ms |
7608 KB |
Output is correct |
91 |
Correct |
18 ms |
7616 KB |
Output is correct |
92 |
Correct |
30 ms |
7620 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
296 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
224 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
724 KB |
Output is correct |
16 |
Correct |
2 ms |
724 KB |
Output is correct |
17 |
Correct |
1 ms |
724 KB |
Output is correct |
18 |
Correct |
1 ms |
688 KB |
Output is correct |
19 |
Correct |
1 ms |
724 KB |
Output is correct |
20 |
Correct |
1 ms |
688 KB |
Output is correct |
21 |
Correct |
1 ms |
724 KB |
Output is correct |
22 |
Correct |
1 ms |
724 KB |
Output is correct |
23 |
Correct |
1 ms |
724 KB |
Output is correct |
24 |
Correct |
11 ms |
2020 KB |
Output is correct |
25 |
Correct |
14 ms |
1992 KB |
Output is correct |
26 |
Correct |
18 ms |
2088 KB |
Output is correct |
27 |
Correct |
9 ms |
1108 KB |
Output is correct |
28 |
Correct |
7 ms |
1084 KB |
Output is correct |
29 |
Correct |
7 ms |
1080 KB |
Output is correct |
30 |
Correct |
7 ms |
1108 KB |
Output is correct |
31 |
Correct |
6 ms |
1108 KB |
Output is correct |
32 |
Correct |
6 ms |
1064 KB |
Output is correct |
33 |
Correct |
181 ms |
2044 KB |
Output is correct |
34 |
Correct |
194 ms |
2004 KB |
Output is correct |
35 |
Correct |
197 ms |
2048 KB |
Output is correct |
36 |
Correct |
183 ms |
2004 KB |
Output is correct |
37 |
Correct |
194 ms |
2040 KB |
Output is correct |
38 |
Correct |
207 ms |
2016 KB |
Output is correct |
39 |
Correct |
17 ms |
3148 KB |
Output is correct |
40 |
Correct |
18 ms |
3116 KB |
Output is correct |
41 |
Correct |
17 ms |
3124 KB |
Output is correct |
42 |
Correct |
0 ms |
212 KB |
Output is correct |
43 |
Correct |
1 ms |
212 KB |
Output is correct |
44 |
Correct |
1 ms |
212 KB |
Output is correct |
45 |
Correct |
0 ms |
212 KB |
Output is correct |
46 |
Correct |
1 ms |
340 KB |
Output is correct |
47 |
Correct |
1 ms |
212 KB |
Output is correct |
48 |
Correct |
1 ms |
212 KB |
Output is correct |
49 |
Correct |
1 ms |
340 KB |
Output is correct |
50 |
Correct |
1 ms |
212 KB |
Output is correct |
51 |
Correct |
3 ms |
4612 KB |
Output is correct |
52 |
Correct |
3 ms |
3672 KB |
Output is correct |
53 |
Correct |
2 ms |
2296 KB |
Output is correct |
54 |
Correct |
4 ms |
4820 KB |
Output is correct |
55 |
Correct |
3 ms |
3484 KB |
Output is correct |
56 |
Correct |
2 ms |
3584 KB |
Output is correct |
57 |
Correct |
1 ms |
212 KB |
Output is correct |
58 |
Correct |
2 ms |
3244 KB |
Output is correct |
59 |
Correct |
1 ms |
340 KB |
Output is correct |
60 |
Correct |
3 ms |
5216 KB |
Output is correct |
61 |
Correct |
2 ms |
3820 KB |
Output is correct |
62 |
Correct |
1 ms |
340 KB |
Output is correct |
63 |
Correct |
1 ms |
340 KB |
Output is correct |
64 |
Correct |
1 ms |
340 KB |
Output is correct |
65 |
Correct |
2 ms |
340 KB |
Output is correct |
66 |
Correct |
1 ms |
340 KB |
Output is correct |
67 |
Correct |
1 ms |
340 KB |
Output is correct |
68 |
Correct |
4 ms |
6476 KB |
Output is correct |
69 |
Correct |
4 ms |
6476 KB |
Output is correct |
70 |
Correct |
4 ms |
6476 KB |
Output is correct |
71 |
Correct |
4 ms |
6476 KB |
Output is correct |
72 |
Correct |
4 ms |
6476 KB |
Output is correct |
73 |
Correct |
5 ms |
6476 KB |
Output is correct |
74 |
Correct |
4 ms |
6476 KB |
Output is correct |
75 |
Correct |
1 ms |
340 KB |
Output is correct |
76 |
Correct |
4 ms |
6476 KB |
Output is correct |
77 |
Correct |
1 ms |
340 KB |
Output is correct |
78 |
Correct |
4 ms |
6476 KB |
Output is correct |
79 |
Correct |
1 ms |
340 KB |
Output is correct |
80 |
Correct |
1 ms |
340 KB |
Output is correct |
81 |
Correct |
1 ms |
340 KB |
Output is correct |
82 |
Correct |
1 ms |
340 KB |
Output is correct |
83 |
Correct |
1 ms |
340 KB |
Output is correct |
84 |
Correct |
1 ms |
340 KB |
Output is correct |
85 |
Correct |
4 ms |
4872 KB |
Output is correct |
86 |
Correct |
4 ms |
3908 KB |
Output is correct |
87 |
Correct |
3 ms |
3304 KB |
Output is correct |
88 |
Correct |
3 ms |
3648 KB |
Output is correct |
89 |
Correct |
3 ms |
3612 KB |
Output is correct |
90 |
Correct |
5 ms |
4436 KB |
Output is correct |
91 |
Correct |
11 ms |
3648 KB |
Output is correct |
92 |
Correct |
14 ms |
4936 KB |
Output is correct |
93 |
Correct |
15 ms |
5464 KB |
Output is correct |
94 |
Correct |
1 ms |
340 KB |
Output is correct |
95 |
Correct |
2 ms |
340 KB |
Output is correct |
96 |
Correct |
1 ms |
340 KB |
Output is correct |
97 |
Correct |
1 ms |
340 KB |
Output is correct |
98 |
Correct |
1 ms |
340 KB |
Output is correct |
99 |
Correct |
6 ms |
6476 KB |
Output is correct |
100 |
Correct |
6 ms |
6476 KB |
Output is correct |
101 |
Correct |
5 ms |
6580 KB |
Output is correct |
102 |
Correct |
5 ms |
6476 KB |
Output is correct |
103 |
Correct |
5 ms |
6476 KB |
Output is correct |
104 |
Correct |
6 ms |
6476 KB |
Output is correct |
105 |
Correct |
17 ms |
7608 KB |
Output is correct |
106 |
Correct |
18 ms |
7616 KB |
Output is correct |
107 |
Correct |
30 ms |
7620 KB |
Output is correct |
108 |
Correct |
15 ms |
2388 KB |
Output is correct |
109 |
Correct |
64 ms |
1748 KB |
Output is correct |
110 |
Correct |
75 ms |
1620 KB |
Output is correct |
111 |
Correct |
58 ms |
1592 KB |
Output is correct |
112 |
Correct |
84 ms |
1916 KB |
Output is correct |
113 |
Correct |
69 ms |
1560 KB |
Output is correct |
114 |
Correct |
169 ms |
134528 KB |
Output is correct |
115 |
Correct |
66 ms |
110692 KB |
Output is correct |
116 |
Correct |
224 ms |
210400 KB |
Output is correct |
117 |
Correct |
106 ms |
94524 KB |
Output is correct |
118 |
Correct |
76 ms |
140512 KB |
Output is correct |
119 |
Correct |
360 ms |
169120 KB |
Output is correct |
120 |
Correct |
162 ms |
93660 KB |
Output is correct |
121 |
Correct |
117 ms |
18520 KB |
Output is correct |
122 |
Correct |
93 ms |
81856 KB |
Output is correct |
123 |
Correct |
74 ms |
17332 KB |
Output is correct |
124 |
Correct |
127 ms |
183624 KB |
Output is correct |
125 |
Correct |
48 ms |
44832 KB |
Output is correct |
126 |
Correct |
56 ms |
110144 KB |
Output is correct |
127 |
Correct |
163 ms |
186128 KB |
Output is correct |
128 |
Correct |
79 ms |
126576 KB |
Output is correct |
129 |
Correct |
72 ms |
93804 KB |
Output is correct |
130 |
Correct |
11 ms |
2388 KB |
Output is correct |
131 |
Correct |
63 ms |
2540 KB |
Output is correct |
132 |
Correct |
136 ms |
2564 KB |
Output is correct |
133 |
Correct |
147 ms |
2568 KB |
Output is correct |
134 |
Correct |
136 ms |
2516 KB |
Output is correct |
135 |
Correct |
148 ms |
2600 KB |
Output is correct |
136 |
Correct |
760 ms |
247580 KB |
Output is correct |
137 |
Correct |
733 ms |
247512 KB |
Output is correct |
138 |
Correct |
810 ms |
247516 KB |
Output is correct |
139 |
Correct |
767 ms |
247508 KB |
Output is correct |
140 |
Correct |
689 ms |
247532 KB |
Output is correct |
141 |
Correct |
692 ms |
247508 KB |
Output is correct |
142 |
Correct |
323 ms |
248104 KB |
Output is correct |
143 |
Correct |
255 ms |
51316 KB |
Output is correct |
144 |
Correct |
339 ms |
248084 KB |
Output is correct |
145 |
Correct |
278 ms |
51308 KB |
Output is correct |
146 |
Correct |
374 ms |
248100 KB |
Output is correct |
147 |
Correct |
235 ms |
51320 KB |
Output is correct |
148 |
Correct |
366 ms |
247136 KB |
Output is correct |
149 |
Correct |
274 ms |
247004 KB |
Output is correct |
150 |
Correct |
195 ms |
246944 KB |
Output is correct |
151 |
Correct |
178 ms |
246956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
1 ms |
296 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
296 KB |
Output is correct |
8 |
Correct |
1 ms |
212 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
224 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
724 KB |
Output is correct |
16 |
Correct |
2 ms |
724 KB |
Output is correct |
17 |
Correct |
1 ms |
724 KB |
Output is correct |
18 |
Correct |
1 ms |
688 KB |
Output is correct |
19 |
Correct |
1 ms |
724 KB |
Output is correct |
20 |
Correct |
1 ms |
688 KB |
Output is correct |
21 |
Correct |
1 ms |
724 KB |
Output is correct |
22 |
Correct |
1 ms |
724 KB |
Output is correct |
23 |
Correct |
1 ms |
724 KB |
Output is correct |
24 |
Correct |
11 ms |
2020 KB |
Output is correct |
25 |
Correct |
14 ms |
1992 KB |
Output is correct |
26 |
Correct |
18 ms |
2088 KB |
Output is correct |
27 |
Correct |
9 ms |
1108 KB |
Output is correct |
28 |
Correct |
7 ms |
1084 KB |
Output is correct |
29 |
Correct |
7 ms |
1080 KB |
Output is correct |
30 |
Correct |
7 ms |
1108 KB |
Output is correct |
31 |
Correct |
6 ms |
1108 KB |
Output is correct |
32 |
Correct |
6 ms |
1064 KB |
Output is correct |
33 |
Correct |
181 ms |
2044 KB |
Output is correct |
34 |
Correct |
194 ms |
2004 KB |
Output is correct |
35 |
Correct |
197 ms |
2048 KB |
Output is correct |
36 |
Correct |
183 ms |
2004 KB |
Output is correct |
37 |
Correct |
194 ms |
2040 KB |
Output is correct |
38 |
Correct |
207 ms |
2016 KB |
Output is correct |
39 |
Correct |
17 ms |
3148 KB |
Output is correct |
40 |
Correct |
18 ms |
3116 KB |
Output is correct |
41 |
Correct |
17 ms |
3124 KB |
Output is correct |
42 |
Correct |
23 ms |
3924 KB |
Output is correct |
43 |
Correct |
16 ms |
2260 KB |
Output is correct |
44 |
Correct |
30 ms |
4020 KB |
Output is correct |
45 |
Correct |
21 ms |
2484 KB |
Output is correct |
46 |
Correct |
24 ms |
2388 KB |
Output is correct |
47 |
Correct |
31 ms |
4216 KB |
Output is correct |
48 |
Execution timed out |
1572 ms |
10804 KB |
Time limit exceeded |
49 |
Halted |
0 ms |
0 KB |
- |