#include "paint.h"
#include <bits/stdc++.h>
#define se second
#define fs first
#define mp make_pair
#define pb push_back
#define ll long long
#define ii pair<ll,ll>
#define ld long double
#define SZ(v) (int)v.size()
#define ALL(v) v.begin(), v.end()
#define bit(msk, i) ((msk >> i) & 1)
#define iter(id, v) for(auto id : v)
#define rep(i,m,n) for(int i=(m); i<=(n); i++)
#define reb(i,m,n) for(int i=(m); i>=(n); i--)
using namespace std;
mt19937_64 rd(chrono :: steady_clock :: now().time_since_epoch().count());
ll Rand(ll l, ll r) { return uniform_int_distribution<ll> (l, r)(rd); }
const int N = 2e5 + 7;
const int Mod = 998244353;
const int szBL = 916;
const int INF = 1e9;
const int BASE = 137;
int n, m, K;
vector<int> A, C;
vector<vector<int>> B;
namespace sub1 {
int idxA[N], f[N];
bool check () {
rep (i, 0, m - 1) iter (&col, B[i]) f[col]++;
return *max_element (f, f + K) <= 1;
}
int solution() {
rep (i, 0, K - 1) idxA[i] = -1;
rep (i, 0, m - 1) {
iter (&col, B[i]) idxA[col] = i;
}
int st = idxA[C[0]];
if (st == -1) return -1;
int res = 1;
rep (i, 1, n - 1) {
if (i % m == 0) ++res;
(st += 1) %= m;
int pos = lower_bound (ALL(B[st]), C[i]) - B[st].begin();
if (pos == SZ(B[st]) || B[st][pos] != C[i]) return -1;
}
return res;
}
}
namespace sub4 {
const int N2 = 20000 + 2;
const int M2 = 2000 + 2;
int dp[N2][M2 * 2], f[N];
bool ok[N2];
vector<int> posC[N];
struct Segment_Tree {
int Range;
int st[N << 2];
void init (int n) {
Range = n;
rep (i, 1, n << 2) {
st[i] = INF;
}
}
void update (int id, int l, int r, int pos, int val) {
if (l > pos || r < pos) return;
if (l == r) {
st[id] = val;
return;
}
int mid = l + r >> 1;
update (id << 1, l, mid, pos, val);
update (id << 1 | 1, mid + 1, r, pos, val);
st[id] = min(st[id << 1], st[id << 1 | 1]);
}
int get (int id, int l, int r, int u, int v) {
if (l > v || r < u) return INF;
if (l >= u && r <= v) return st[id];
int mid = l + r >> 1;
return min (get (id << 1, l, mid, u, v), get (id << 1 | 1, mid + 1, r, u, v));
}
void update (int pos, int val ) {
update (1, 1, Range, pos, val);
}
int get (int u, int v) {
return get (1, 1, Range, u, v);
}
}ST;
int solution() {
A.resize (2 * m);
B.resize (2 * m);
rep (i, m, 2 * m - 1) {
A[i] = A[i - m];
B[i] = B[i - m];
}
rep (i, 0, n - 1) posC[C[i]].push_back(i);
rep (j, 0, 2 * m - 1) {
iter (&col, B[j])
iter (&pos, posC[col]) {
dp[pos][j] = 1;
}
}
reb (i, n - 1, 0) {
reb (j, 2 * m - 1, 0) {
if (dp[i][j] != 0) dp[i][j] = dp[i + 1][j + 1] + 1;
if (dp[i][j] >= m) ok[i + 1] = 1;
}
}
rep (i, 1, n) f[i] = INF;
ST.init(n);
f[m] = ok[1] ? 1 : INF;
ST.update (m, f[m]);
rep (i, 2, n - m + 1) {
if (ok[i]) {
f[i + m - 1] = ST.get (i - 1, i + m - 1) + 1;
ST.update (i + m - 1, f[i + m - 1]);
}
}
if (f[n] < INF) return f[n];
else return -1;
}
}
namespace sub5 {
struct Segment_Tree {
int Range;
int st[N << 2];
void init (int n) {
Range = n;
rep (i, 1, n << 2) {
st[i] = 0;
}
}
void update (int id, int l, int r, int pos, int val) {
if (l > pos || r < pos) return;
if (l == r) {
st[id] += val;
return;
}
int mid = l + r >> 1;
update (id << 1, l, mid, pos, val);
update (id << 1 | 1, mid + 1, r, pos, val);
st[id] = max(st[id << 1], st[id << 1 | 1]);
}
void update (int pos, int val ) {
update (1, 1, Range, pos + 1, val);
}
}tot; ///rotation
struct Segment_Tree2 {
int Range;
int st[N << 2];
void init (int n) {
Range = n;
rep (i, 1, n << 2) {
st[i] = INF;
}
}
void update (int id, int l, int r, int pos, int val) {
if (l > pos || r < pos) return;
if (l == r) {
st[id] = val;
return;
}
int mid = l + r >> 1;
update (id << 1, l, mid, pos, val);
update (id << 1 | 1, mid + 1, r, pos, val);
st[id] = min(st[id << 1], st[id << 1 | 1]);
}
int get (int id, int l, int r, int u, int v) {
if (l > v || r < u) return INF;
if (l >= u && r <= v) return st[id];
int mid = l + r >> 1;
return min (get (id << 1, l, mid, u, v), get (id << 1 | 1, mid + 1, r, u, v));
}
void update (int pos, int val ) {
update (1, 1, Range, pos, val);
}
int get (int u, int v) {
return get (1, 1, Range, u, v);
}
}ST;
vector<int> F[N];
bool ok[N];
int f[N];
int solution() {
rep (i, 0, m - 1) {
iter (&col, B[i]) F[col].push_back(i);
}
tot.init (m);
rep (i, 0, m - 1) {
iter (&pos, F[C[i]]) {
tot.update((pos - i % m + m) % m, 1);
}
}
if (tot.st[1] == m) ok[1] = 1;
rep (i, 1, n - m) {
iter (&pos, F[C[i - 1]]) {
tot.update((pos - (i - 1) % m + m) % m, -1);
}
iter (&pos, F[C[i + m - 1]]) {
tot.update ((pos - (i - 1) % m + m) % m, 1);
}
if (tot.st[1] == m) ok[i + 1] = 1;
}
rep (i, 1, n) f[i] = INF;
ST.init(n);
f[m] = ok[1] ? 1 : INF;
ST.update (m, f[m]);
rep (i, 2, n - m + 1) {
if (ok[i]) {
f[i + m - 1] = ST.get (i - 1, i + m - 1) + 1;
ST.update (i + m - 1, f[i + m - 1]);
}
}
if (f[n] < INF) return f[n];
else return -1;
}
}
int minimumInstructions (int _n, int _m, int _K, vector<int> _C, vector<int> _A, vector<vector<int>> _B) {
//void solution() {
n = _n;
m = _m;
K = _K;
C = _C;
A = _A;
B = _B;
// cin >> n >> m >> K;
// C.resize(n);
// rep (i, 0, n - 1) {
// cin >> C[i];
//
// }
// A.resize (m);
// B.resize (m);
// rep (i, 0, m - 1) {
// cin >> A[i];
// B[i].resize (A[i]);
// rep (j, 0, A[i] - 1) {
// cin >> B[i][j];
// }
// }
// if (sub1 :: check())
// return sub1 :: solution();
//// cout << sub1 :: solution() <<"\n";
// else if (n <= 20000 && m <= 2000)
// return sub4 :: solution();
//// cout << sub4 :: solution() <<"\n";
// else
return sub5 :: solution();
// cout << sub5 :: solution() <<"\n";
}
//#define file(name) freopen(name".inp", "r", stdin); freopen(name".out", "w", stdout);
//int main () {
// ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
//// file ("c");
// int num_Test = 1;
//// cin >> num_Test;
// while (num_Test--)
// solution();
//}
/*
8 3 5
3 3 1 3 4 4 2 2
3 0 1 2
2 2 3
2 3 4
5 4 4
1 0 1 2 2
2 0 1
1 1
1 2
1 3
*/
Compilation message
paint.cpp: In member function 'void sub4::Segment_Tree::update(int, int, int, int, int)':
paint.cpp:84:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
84 | int mid = l + r >> 1;
| ~~^~~
paint.cpp: In member function 'int sub4::Segment_Tree::get(int, int, int, int, int)':
paint.cpp:92:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
92 | int mid = l + r >> 1;
| ~~^~~
paint.cpp: In member function 'void sub5::Segment_Tree::update(int, int, int, int, int)':
paint.cpp:157:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
157 | int mid = l + r >> 1;
| ~~^~~
paint.cpp: In member function 'void sub5::Segment_Tree2::update(int, int, int, int, int)':
paint.cpp:183:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
183 | int mid = l + r >> 1;
| ~~^~~
paint.cpp: In member function 'int sub5::Segment_Tree2::get(int, int, int, int, int)':
paint.cpp:191:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
191 | int mid = l + r >> 1;
| ~~^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14680 KB |
Output is correct |
2 |
Correct |
2 ms |
14684 KB |
Output is correct |
3 |
Correct |
2 ms |
14684 KB |
Output is correct |
4 |
Correct |
2 ms |
14684 KB |
Output is correct |
5 |
Correct |
2 ms |
14684 KB |
Output is correct |
6 |
Correct |
2 ms |
14684 KB |
Output is correct |
7 |
Correct |
2 ms |
14680 KB |
Output is correct |
8 |
Correct |
2 ms |
14684 KB |
Output is correct |
9 |
Correct |
2 ms |
14684 KB |
Output is correct |
10 |
Correct |
2 ms |
14684 KB |
Output is correct |
11 |
Correct |
2 ms |
14684 KB |
Output is correct |
12 |
Correct |
2 ms |
14684 KB |
Output is correct |
13 |
Correct |
2 ms |
14684 KB |
Output is correct |
14 |
Correct |
2 ms |
14684 KB |
Output is correct |
15 |
Correct |
2 ms |
14684 KB |
Output is correct |
16 |
Correct |
2 ms |
14684 KB |
Output is correct |
17 |
Correct |
2 ms |
14680 KB |
Output is correct |
18 |
Correct |
2 ms |
14856 KB |
Output is correct |
19 |
Correct |
2 ms |
14876 KB |
Output is correct |
20 |
Correct |
3 ms |
14884 KB |
Output is correct |
21 |
Correct |
4 ms |
14684 KB |
Output is correct |
22 |
Correct |
17 ms |
19036 KB |
Output is correct |
23 |
Correct |
16 ms |
19036 KB |
Output is correct |
24 |
Correct |
16 ms |
19140 KB |
Output is correct |
25 |
Correct |
5 ms |
14940 KB |
Output is correct |
26 |
Correct |
5 ms |
14940 KB |
Output is correct |
27 |
Correct |
5 ms |
14940 KB |
Output is correct |
28 |
Correct |
5 ms |
14940 KB |
Output is correct |
29 |
Correct |
4 ms |
14940 KB |
Output is correct |
30 |
Correct |
4 ms |
14940 KB |
Output is correct |
31 |
Correct |
11 ms |
15964 KB |
Output is correct |
32 |
Correct |
11 ms |
15964 KB |
Output is correct |
33 |
Correct |
11 ms |
16188 KB |
Output is correct |
34 |
Correct |
11 ms |
15964 KB |
Output is correct |
35 |
Correct |
13 ms |
15964 KB |
Output is correct |
36 |
Correct |
13 ms |
15960 KB |
Output is correct |
37 |
Correct |
24 ms |
19548 KB |
Output is correct |
38 |
Correct |
21 ms |
19544 KB |
Output is correct |
39 |
Correct |
21 ms |
19540 KB |
Output is correct |
40 |
Correct |
19 ms |
18012 KB |
Output is correct |
41 |
Correct |
13 ms |
17592 KB |
Output is correct |
42 |
Correct |
17 ms |
18012 KB |
Output is correct |
43 |
Correct |
9 ms |
17752 KB |
Output is correct |
44 |
Correct |
8 ms |
17500 KB |
Output is correct |
45 |
Correct |
14 ms |
18012 KB |
Output is correct |
46 |
Correct |
43 ms |
29268 KB |
Output is correct |
47 |
Correct |
28 ms |
23644 KB |
Output is correct |
48 |
Correct |
28 ms |
27424 KB |
Output is correct |
49 |
Correct |
47 ms |
27224 KB |
Output is correct |
50 |
Correct |
49 ms |
26452 KB |
Output is correct |
51 |
Correct |
38 ms |
23380 KB |
Output is correct |
52 |
Correct |
21 ms |
18012 KB |
Output is correct |
53 |
Correct |
20 ms |
18204 KB |
Output is correct |
54 |
Correct |
17 ms |
18260 KB |
Output is correct |
55 |
Correct |
16 ms |
18264 KB |
Output is correct |
56 |
Correct |
12 ms |
18012 KB |
Output is correct |
57 |
Correct |
12 ms |
18012 KB |
Output is correct |
58 |
Correct |
46 ms |
30036 KB |
Output is correct |
59 |
Correct |
46 ms |
30032 KB |
Output is correct |
60 |
Correct |
47 ms |
30032 KB |
Output is correct |
61 |
Correct |
49 ms |
30032 KB |
Output is correct |
62 |
Correct |
47 ms |
30036 KB |
Output is correct |
63 |
Correct |
46 ms |
30036 KB |
Output is correct |
64 |
Correct |
56 ms |
28800 KB |
Output is correct |
65 |
Correct |
56 ms |
28752 KB |
Output is correct |
66 |
Correct |
59 ms |
28756 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14680 KB |
Output is correct |
2 |
Correct |
2 ms |
14684 KB |
Output is correct |
3 |
Correct |
2 ms |
14684 KB |
Output is correct |
4 |
Correct |
2 ms |
14684 KB |
Output is correct |
5 |
Correct |
2 ms |
14684 KB |
Output is correct |
6 |
Correct |
2 ms |
14684 KB |
Output is correct |
7 |
Correct |
2 ms |
14680 KB |
Output is correct |
8 |
Correct |
2 ms |
14684 KB |
Output is correct |
9 |
Correct |
2 ms |
14684 KB |
Output is correct |
10 |
Correct |
2 ms |
14684 KB |
Output is correct |
11 |
Correct |
2 ms |
14684 KB |
Output is correct |
12 |
Correct |
2 ms |
14684 KB |
Output is correct |
13 |
Correct |
2 ms |
14684 KB |
Output is correct |
14 |
Correct |
2 ms |
14684 KB |
Output is correct |
15 |
Correct |
2 ms |
14684 KB |
Output is correct |
16 |
Correct |
2 ms |
14684 KB |
Output is correct |
17 |
Correct |
2 ms |
14680 KB |
Output is correct |
18 |
Correct |
2 ms |
14856 KB |
Output is correct |
19 |
Correct |
2 ms |
14876 KB |
Output is correct |
20 |
Correct |
3 ms |
14884 KB |
Output is correct |
21 |
Correct |
4 ms |
14684 KB |
Output is correct |
22 |
Correct |
2 ms |
14684 KB |
Output is correct |
23 |
Correct |
2 ms |
14684 KB |
Output is correct |
24 |
Correct |
2 ms |
14684 KB |
Output is correct |
25 |
Correct |
2 ms |
14684 KB |
Output is correct |
26 |
Correct |
2 ms |
14684 KB |
Output is correct |
27 |
Correct |
2 ms |
14788 KB |
Output is correct |
28 |
Correct |
2 ms |
14680 KB |
Output is correct |
29 |
Correct |
2 ms |
14684 KB |
Output is correct |
30 |
Correct |
2 ms |
14684 KB |
Output is correct |
31 |
Correct |
2 ms |
14744 KB |
Output is correct |
32 |
Correct |
2 ms |
14680 KB |
Output is correct |
33 |
Correct |
3 ms |
14684 KB |
Output is correct |
34 |
Correct |
2 ms |
14684 KB |
Output is correct |
35 |
Correct |
2 ms |
14684 KB |
Output is correct |
36 |
Correct |
2 ms |
14684 KB |
Output is correct |
37 |
Correct |
2 ms |
14684 KB |
Output is correct |
38 |
Correct |
2 ms |
14684 KB |
Output is correct |
39 |
Correct |
2 ms |
14684 KB |
Output is correct |
40 |
Correct |
3 ms |
14684 KB |
Output is correct |
41 |
Correct |
3 ms |
14684 KB |
Output is correct |
42 |
Correct |
2 ms |
14684 KB |
Output is correct |
43 |
Correct |
2 ms |
14684 KB |
Output is correct |
44 |
Correct |
2 ms |
14816 KB |
Output is correct |
45 |
Correct |
2 ms |
14684 KB |
Output is correct |
46 |
Correct |
2 ms |
14684 KB |
Output is correct |
47 |
Correct |
3 ms |
14684 KB |
Output is correct |
48 |
Correct |
2 ms |
14684 KB |
Output is correct |
49 |
Correct |
3 ms |
14684 KB |
Output is correct |
50 |
Correct |
3 ms |
14684 KB |
Output is correct |
51 |
Correct |
2 ms |
14680 KB |
Output is correct |
52 |
Correct |
2 ms |
14680 KB |
Output is correct |
53 |
Correct |
3 ms |
14684 KB |
Output is correct |
54 |
Correct |
2 ms |
14684 KB |
Output is correct |
55 |
Correct |
3 ms |
14680 KB |
Output is correct |
56 |
Correct |
2 ms |
14684 KB |
Output is correct |
57 |
Correct |
2 ms |
14684 KB |
Output is correct |
58 |
Correct |
2 ms |
14684 KB |
Output is correct |
59 |
Correct |
2 ms |
14684 KB |
Output is correct |
60 |
Correct |
2 ms |
14684 KB |
Output is correct |
61 |
Correct |
2 ms |
14684 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14684 KB |
Output is correct |
2 |
Correct |
2 ms |
14684 KB |
Output is correct |
3 |
Correct |
2 ms |
14680 KB |
Output is correct |
4 |
Correct |
2 ms |
14684 KB |
Output is correct |
5 |
Correct |
2 ms |
14684 KB |
Output is correct |
6 |
Correct |
2 ms |
14684 KB |
Output is correct |
7 |
Correct |
2 ms |
14684 KB |
Output is correct |
8 |
Correct |
2 ms |
14684 KB |
Output is correct |
9 |
Correct |
2 ms |
14680 KB |
Output is correct |
10 |
Correct |
2 ms |
14684 KB |
Output is correct |
11 |
Correct |
2 ms |
14684 KB |
Output is correct |
12 |
Correct |
2 ms |
14684 KB |
Output is correct |
13 |
Correct |
2 ms |
14684 KB |
Output is correct |
14 |
Correct |
2 ms |
14684 KB |
Output is correct |
15 |
Correct |
2 ms |
14684 KB |
Output is correct |
16 |
Correct |
2 ms |
14684 KB |
Output is correct |
17 |
Correct |
2 ms |
14684 KB |
Output is correct |
18 |
Correct |
2 ms |
14684 KB |
Output is correct |
19 |
Correct |
2 ms |
14680 KB |
Output is correct |
20 |
Correct |
2 ms |
14856 KB |
Output is correct |
21 |
Correct |
2 ms |
14876 KB |
Output is correct |
22 |
Correct |
3 ms |
14884 KB |
Output is correct |
23 |
Correct |
4 ms |
14684 KB |
Output is correct |
24 |
Correct |
17 ms |
19036 KB |
Output is correct |
25 |
Correct |
16 ms |
19036 KB |
Output is correct |
26 |
Correct |
16 ms |
19140 KB |
Output is correct |
27 |
Correct |
2 ms |
14684 KB |
Output is correct |
28 |
Correct |
2 ms |
14684 KB |
Output is correct |
29 |
Correct |
2 ms |
14684 KB |
Output is correct |
30 |
Correct |
2 ms |
14788 KB |
Output is correct |
31 |
Correct |
2 ms |
14680 KB |
Output is correct |
32 |
Correct |
2 ms |
14684 KB |
Output is correct |
33 |
Correct |
2 ms |
14684 KB |
Output is correct |
34 |
Correct |
2 ms |
14744 KB |
Output is correct |
35 |
Correct |
2 ms |
14680 KB |
Output is correct |
36 |
Correct |
3 ms |
14684 KB |
Output is correct |
37 |
Correct |
2 ms |
14684 KB |
Output is correct |
38 |
Correct |
2 ms |
14684 KB |
Output is correct |
39 |
Correct |
2 ms |
14684 KB |
Output is correct |
40 |
Correct |
2 ms |
14684 KB |
Output is correct |
41 |
Correct |
2 ms |
14684 KB |
Output is correct |
42 |
Correct |
2 ms |
14684 KB |
Output is correct |
43 |
Correct |
3 ms |
14684 KB |
Output is correct |
44 |
Correct |
3 ms |
14684 KB |
Output is correct |
45 |
Correct |
2 ms |
14684 KB |
Output is correct |
46 |
Correct |
2 ms |
14684 KB |
Output is correct |
47 |
Correct |
2 ms |
14816 KB |
Output is correct |
48 |
Correct |
2 ms |
14684 KB |
Output is correct |
49 |
Correct |
2 ms |
14684 KB |
Output is correct |
50 |
Correct |
3 ms |
14684 KB |
Output is correct |
51 |
Correct |
2 ms |
14684 KB |
Output is correct |
52 |
Correct |
3 ms |
14684 KB |
Output is correct |
53 |
Correct |
3 ms |
14684 KB |
Output is correct |
54 |
Correct |
2 ms |
14680 KB |
Output is correct |
55 |
Correct |
2 ms |
14680 KB |
Output is correct |
56 |
Correct |
3 ms |
14684 KB |
Output is correct |
57 |
Correct |
2 ms |
14684 KB |
Output is correct |
58 |
Correct |
3 ms |
14680 KB |
Output is correct |
59 |
Correct |
2 ms |
14684 KB |
Output is correct |
60 |
Correct |
2 ms |
14684 KB |
Output is correct |
61 |
Correct |
2 ms |
14684 KB |
Output is correct |
62 |
Correct |
2 ms |
14684 KB |
Output is correct |
63 |
Correct |
2 ms |
14684 KB |
Output is correct |
64 |
Correct |
2 ms |
14684 KB |
Output is correct |
65 |
Correct |
4 ms |
14680 KB |
Output is correct |
66 |
Correct |
3 ms |
14684 KB |
Output is correct |
67 |
Correct |
4 ms |
14836 KB |
Output is correct |
68 |
Correct |
3 ms |
14680 KB |
Output is correct |
69 |
Correct |
3 ms |
14684 KB |
Output is correct |
70 |
Correct |
3 ms |
14940 KB |
Output is correct |
71 |
Correct |
4 ms |
15068 KB |
Output is correct |
72 |
Correct |
3 ms |
14940 KB |
Output is correct |
73 |
Correct |
3 ms |
14940 KB |
Output is correct |
74 |
Correct |
3 ms |
14940 KB |
Output is correct |
75 |
Correct |
4 ms |
14936 KB |
Output is correct |
76 |
Correct |
17 ms |
17788 KB |
Output is correct |
77 |
Correct |
13 ms |
18268 KB |
Output is correct |
78 |
Correct |
19 ms |
18780 KB |
Output is correct |
79 |
Correct |
6 ms |
14684 KB |
Output is correct |
80 |
Correct |
7 ms |
14684 KB |
Output is correct |
81 |
Correct |
6 ms |
14856 KB |
Output is correct |
82 |
Correct |
6 ms |
14684 KB |
Output is correct |
83 |
Correct |
6 ms |
14684 KB |
Output is correct |
84 |
Correct |
5 ms |
14940 KB |
Output is correct |
85 |
Correct |
4 ms |
14940 KB |
Output is correct |
86 |
Correct |
4 ms |
14940 KB |
Output is correct |
87 |
Correct |
4 ms |
14940 KB |
Output is correct |
88 |
Correct |
4 ms |
15120 KB |
Output is correct |
89 |
Correct |
4 ms |
14940 KB |
Output is correct |
90 |
Correct |
26 ms |
19036 KB |
Output is correct |
91 |
Correct |
20 ms |
19036 KB |
Output is correct |
92 |
Correct |
19 ms |
18944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14684 KB |
Output is correct |
2 |
Correct |
2 ms |
14684 KB |
Output is correct |
3 |
Correct |
2 ms |
14680 KB |
Output is correct |
4 |
Correct |
2 ms |
14684 KB |
Output is correct |
5 |
Correct |
2 ms |
14684 KB |
Output is correct |
6 |
Correct |
2 ms |
14684 KB |
Output is correct |
7 |
Correct |
2 ms |
14684 KB |
Output is correct |
8 |
Correct |
2 ms |
14684 KB |
Output is correct |
9 |
Correct |
2 ms |
14680 KB |
Output is correct |
10 |
Correct |
2 ms |
14684 KB |
Output is correct |
11 |
Correct |
2 ms |
14684 KB |
Output is correct |
12 |
Correct |
2 ms |
14684 KB |
Output is correct |
13 |
Correct |
2 ms |
14684 KB |
Output is correct |
14 |
Correct |
2 ms |
14684 KB |
Output is correct |
15 |
Correct |
2 ms |
14684 KB |
Output is correct |
16 |
Correct |
2 ms |
14684 KB |
Output is correct |
17 |
Correct |
2 ms |
14684 KB |
Output is correct |
18 |
Correct |
2 ms |
14684 KB |
Output is correct |
19 |
Correct |
2 ms |
14680 KB |
Output is correct |
20 |
Correct |
2 ms |
14856 KB |
Output is correct |
21 |
Correct |
2 ms |
14876 KB |
Output is correct |
22 |
Correct |
3 ms |
14884 KB |
Output is correct |
23 |
Correct |
4 ms |
14684 KB |
Output is correct |
24 |
Correct |
17 ms |
19036 KB |
Output is correct |
25 |
Correct |
16 ms |
19036 KB |
Output is correct |
26 |
Correct |
16 ms |
19140 KB |
Output is correct |
27 |
Correct |
5 ms |
14940 KB |
Output is correct |
28 |
Correct |
5 ms |
14940 KB |
Output is correct |
29 |
Correct |
5 ms |
14940 KB |
Output is correct |
30 |
Correct |
5 ms |
14940 KB |
Output is correct |
31 |
Correct |
4 ms |
14940 KB |
Output is correct |
32 |
Correct |
4 ms |
14940 KB |
Output is correct |
33 |
Correct |
11 ms |
15964 KB |
Output is correct |
34 |
Correct |
11 ms |
15964 KB |
Output is correct |
35 |
Correct |
11 ms |
16188 KB |
Output is correct |
36 |
Correct |
11 ms |
15964 KB |
Output is correct |
37 |
Correct |
13 ms |
15964 KB |
Output is correct |
38 |
Correct |
13 ms |
15960 KB |
Output is correct |
39 |
Correct |
24 ms |
19548 KB |
Output is correct |
40 |
Correct |
21 ms |
19544 KB |
Output is correct |
41 |
Correct |
21 ms |
19540 KB |
Output is correct |
42 |
Correct |
2 ms |
14684 KB |
Output is correct |
43 |
Correct |
2 ms |
14684 KB |
Output is correct |
44 |
Correct |
2 ms |
14684 KB |
Output is correct |
45 |
Correct |
2 ms |
14788 KB |
Output is correct |
46 |
Correct |
2 ms |
14680 KB |
Output is correct |
47 |
Correct |
2 ms |
14684 KB |
Output is correct |
48 |
Correct |
2 ms |
14684 KB |
Output is correct |
49 |
Correct |
2 ms |
14744 KB |
Output is correct |
50 |
Correct |
2 ms |
14680 KB |
Output is correct |
51 |
Correct |
3 ms |
14684 KB |
Output is correct |
52 |
Correct |
2 ms |
14684 KB |
Output is correct |
53 |
Correct |
2 ms |
14684 KB |
Output is correct |
54 |
Correct |
2 ms |
14684 KB |
Output is correct |
55 |
Correct |
2 ms |
14684 KB |
Output is correct |
56 |
Correct |
2 ms |
14684 KB |
Output is correct |
57 |
Correct |
2 ms |
14684 KB |
Output is correct |
58 |
Correct |
3 ms |
14684 KB |
Output is correct |
59 |
Correct |
3 ms |
14684 KB |
Output is correct |
60 |
Correct |
2 ms |
14684 KB |
Output is correct |
61 |
Correct |
2 ms |
14684 KB |
Output is correct |
62 |
Correct |
2 ms |
14816 KB |
Output is correct |
63 |
Correct |
2 ms |
14684 KB |
Output is correct |
64 |
Correct |
2 ms |
14684 KB |
Output is correct |
65 |
Correct |
3 ms |
14684 KB |
Output is correct |
66 |
Correct |
2 ms |
14684 KB |
Output is correct |
67 |
Correct |
3 ms |
14684 KB |
Output is correct |
68 |
Correct |
3 ms |
14684 KB |
Output is correct |
69 |
Correct |
2 ms |
14680 KB |
Output is correct |
70 |
Correct |
2 ms |
14680 KB |
Output is correct |
71 |
Correct |
3 ms |
14684 KB |
Output is correct |
72 |
Correct |
2 ms |
14684 KB |
Output is correct |
73 |
Correct |
3 ms |
14680 KB |
Output is correct |
74 |
Correct |
2 ms |
14684 KB |
Output is correct |
75 |
Correct |
2 ms |
14684 KB |
Output is correct |
76 |
Correct |
2 ms |
14684 KB |
Output is correct |
77 |
Correct |
2 ms |
14684 KB |
Output is correct |
78 |
Correct |
2 ms |
14684 KB |
Output is correct |
79 |
Correct |
2 ms |
14684 KB |
Output is correct |
80 |
Correct |
4 ms |
14680 KB |
Output is correct |
81 |
Correct |
3 ms |
14684 KB |
Output is correct |
82 |
Correct |
4 ms |
14836 KB |
Output is correct |
83 |
Correct |
3 ms |
14680 KB |
Output is correct |
84 |
Correct |
3 ms |
14684 KB |
Output is correct |
85 |
Correct |
3 ms |
14940 KB |
Output is correct |
86 |
Correct |
4 ms |
15068 KB |
Output is correct |
87 |
Correct |
3 ms |
14940 KB |
Output is correct |
88 |
Correct |
3 ms |
14940 KB |
Output is correct |
89 |
Correct |
3 ms |
14940 KB |
Output is correct |
90 |
Correct |
4 ms |
14936 KB |
Output is correct |
91 |
Correct |
17 ms |
17788 KB |
Output is correct |
92 |
Correct |
13 ms |
18268 KB |
Output is correct |
93 |
Correct |
19 ms |
18780 KB |
Output is correct |
94 |
Correct |
6 ms |
14684 KB |
Output is correct |
95 |
Correct |
7 ms |
14684 KB |
Output is correct |
96 |
Correct |
6 ms |
14856 KB |
Output is correct |
97 |
Correct |
6 ms |
14684 KB |
Output is correct |
98 |
Correct |
6 ms |
14684 KB |
Output is correct |
99 |
Correct |
5 ms |
14940 KB |
Output is correct |
100 |
Correct |
4 ms |
14940 KB |
Output is correct |
101 |
Correct |
4 ms |
14940 KB |
Output is correct |
102 |
Correct |
4 ms |
14940 KB |
Output is correct |
103 |
Correct |
4 ms |
15120 KB |
Output is correct |
104 |
Correct |
4 ms |
14940 KB |
Output is correct |
105 |
Correct |
26 ms |
19036 KB |
Output is correct |
106 |
Correct |
20 ms |
19036 KB |
Output is correct |
107 |
Correct |
19 ms |
18944 KB |
Output is correct |
108 |
Correct |
5 ms |
14936 KB |
Output is correct |
109 |
Correct |
439 ms |
15064 KB |
Output is correct |
110 |
Correct |
306 ms |
15044 KB |
Output is correct |
111 |
Correct |
238 ms |
15052 KB |
Output is correct |
112 |
Correct |
301 ms |
15116 KB |
Output is correct |
113 |
Correct |
214 ms |
14940 KB |
Output is correct |
114 |
Correct |
14 ms |
16216 KB |
Output is correct |
115 |
Correct |
12 ms |
16120 KB |
Output is correct |
116 |
Correct |
17 ms |
16476 KB |
Output is correct |
117 |
Correct |
13 ms |
16220 KB |
Output is correct |
118 |
Correct |
15 ms |
16348 KB |
Output is correct |
119 |
Correct |
15 ms |
15960 KB |
Output is correct |
120 |
Correct |
17 ms |
17692 KB |
Output is correct |
121 |
Correct |
9 ms |
15452 KB |
Output is correct |
122 |
Correct |
20 ms |
18012 KB |
Output is correct |
123 |
Correct |
8 ms |
15368 KB |
Output is correct |
124 |
Correct |
22 ms |
18524 KB |
Output is correct |
125 |
Correct |
11 ms |
15636 KB |
Output is correct |
126 |
Correct |
8 ms |
15708 KB |
Output is correct |
127 |
Correct |
9 ms |
15992 KB |
Output is correct |
128 |
Correct |
7 ms |
15620 KB |
Output is correct |
129 |
Correct |
7 ms |
15708 KB |
Output is correct |
130 |
Correct |
6 ms |
15116 KB |
Output is correct |
131 |
Correct |
632 ms |
15140 KB |
Output is correct |
132 |
Correct |
561 ms |
15184 KB |
Output is correct |
133 |
Correct |
548 ms |
15196 KB |
Output is correct |
134 |
Correct |
521 ms |
15204 KB |
Output is correct |
135 |
Correct |
458 ms |
15196 KB |
Output is correct |
136 |
Correct |
27 ms |
16732 KB |
Output is correct |
137 |
Correct |
21 ms |
16732 KB |
Output is correct |
138 |
Correct |
21 ms |
16732 KB |
Output is correct |
139 |
Correct |
21 ms |
16732 KB |
Output is correct |
140 |
Correct |
22 ms |
16732 KB |
Output is correct |
141 |
Correct |
21 ms |
16864 KB |
Output is correct |
142 |
Correct |
27 ms |
19544 KB |
Output is correct |
143 |
Correct |
14 ms |
15708 KB |
Output is correct |
144 |
Correct |
26 ms |
19656 KB |
Output is correct |
145 |
Correct |
15 ms |
15708 KB |
Output is correct |
146 |
Correct |
28 ms |
19612 KB |
Output is correct |
147 |
Correct |
15 ms |
15704 KB |
Output is correct |
148 |
Correct |
10 ms |
16220 KB |
Output is correct |
149 |
Correct |
9 ms |
16024 KB |
Output is correct |
150 |
Correct |
9 ms |
15964 KB |
Output is correct |
151 |
Correct |
9 ms |
15904 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
14684 KB |
Output is correct |
2 |
Correct |
2 ms |
14684 KB |
Output is correct |
3 |
Correct |
2 ms |
14680 KB |
Output is correct |
4 |
Correct |
2 ms |
14684 KB |
Output is correct |
5 |
Correct |
2 ms |
14684 KB |
Output is correct |
6 |
Correct |
2 ms |
14684 KB |
Output is correct |
7 |
Correct |
2 ms |
14684 KB |
Output is correct |
8 |
Correct |
2 ms |
14684 KB |
Output is correct |
9 |
Correct |
2 ms |
14680 KB |
Output is correct |
10 |
Correct |
2 ms |
14684 KB |
Output is correct |
11 |
Correct |
2 ms |
14684 KB |
Output is correct |
12 |
Correct |
2 ms |
14684 KB |
Output is correct |
13 |
Correct |
2 ms |
14684 KB |
Output is correct |
14 |
Correct |
2 ms |
14684 KB |
Output is correct |
15 |
Correct |
2 ms |
14684 KB |
Output is correct |
16 |
Correct |
2 ms |
14684 KB |
Output is correct |
17 |
Correct |
2 ms |
14684 KB |
Output is correct |
18 |
Correct |
2 ms |
14684 KB |
Output is correct |
19 |
Correct |
2 ms |
14680 KB |
Output is correct |
20 |
Correct |
2 ms |
14856 KB |
Output is correct |
21 |
Correct |
2 ms |
14876 KB |
Output is correct |
22 |
Correct |
3 ms |
14884 KB |
Output is correct |
23 |
Correct |
4 ms |
14684 KB |
Output is correct |
24 |
Correct |
17 ms |
19036 KB |
Output is correct |
25 |
Correct |
16 ms |
19036 KB |
Output is correct |
26 |
Correct |
16 ms |
19140 KB |
Output is correct |
27 |
Correct |
5 ms |
14940 KB |
Output is correct |
28 |
Correct |
5 ms |
14940 KB |
Output is correct |
29 |
Correct |
5 ms |
14940 KB |
Output is correct |
30 |
Correct |
5 ms |
14940 KB |
Output is correct |
31 |
Correct |
4 ms |
14940 KB |
Output is correct |
32 |
Correct |
4 ms |
14940 KB |
Output is correct |
33 |
Correct |
11 ms |
15964 KB |
Output is correct |
34 |
Correct |
11 ms |
15964 KB |
Output is correct |
35 |
Correct |
11 ms |
16188 KB |
Output is correct |
36 |
Correct |
11 ms |
15964 KB |
Output is correct |
37 |
Correct |
13 ms |
15964 KB |
Output is correct |
38 |
Correct |
13 ms |
15960 KB |
Output is correct |
39 |
Correct |
24 ms |
19548 KB |
Output is correct |
40 |
Correct |
21 ms |
19544 KB |
Output is correct |
41 |
Correct |
21 ms |
19540 KB |
Output is correct |
42 |
Correct |
19 ms |
18012 KB |
Output is correct |
43 |
Correct |
13 ms |
17592 KB |
Output is correct |
44 |
Correct |
17 ms |
18012 KB |
Output is correct |
45 |
Correct |
9 ms |
17752 KB |
Output is correct |
46 |
Correct |
8 ms |
17500 KB |
Output is correct |
47 |
Correct |
14 ms |
18012 KB |
Output is correct |
48 |
Correct |
43 ms |
29268 KB |
Output is correct |
49 |
Correct |
28 ms |
23644 KB |
Output is correct |
50 |
Correct |
28 ms |
27424 KB |
Output is correct |
51 |
Correct |
47 ms |
27224 KB |
Output is correct |
52 |
Correct |
49 ms |
26452 KB |
Output is correct |
53 |
Correct |
38 ms |
23380 KB |
Output is correct |
54 |
Correct |
21 ms |
18012 KB |
Output is correct |
55 |
Correct |
20 ms |
18204 KB |
Output is correct |
56 |
Correct |
17 ms |
18260 KB |
Output is correct |
57 |
Correct |
16 ms |
18264 KB |
Output is correct |
58 |
Correct |
12 ms |
18012 KB |
Output is correct |
59 |
Correct |
12 ms |
18012 KB |
Output is correct |
60 |
Correct |
46 ms |
30036 KB |
Output is correct |
61 |
Correct |
46 ms |
30032 KB |
Output is correct |
62 |
Correct |
47 ms |
30032 KB |
Output is correct |
63 |
Correct |
49 ms |
30032 KB |
Output is correct |
64 |
Correct |
47 ms |
30036 KB |
Output is correct |
65 |
Correct |
46 ms |
30036 KB |
Output is correct |
66 |
Correct |
56 ms |
28800 KB |
Output is correct |
67 |
Correct |
56 ms |
28752 KB |
Output is correct |
68 |
Correct |
59 ms |
28756 KB |
Output is correct |
69 |
Correct |
2 ms |
14684 KB |
Output is correct |
70 |
Correct |
2 ms |
14684 KB |
Output is correct |
71 |
Correct |
2 ms |
14684 KB |
Output is correct |
72 |
Correct |
2 ms |
14788 KB |
Output is correct |
73 |
Correct |
2 ms |
14680 KB |
Output is correct |
74 |
Correct |
2 ms |
14684 KB |
Output is correct |
75 |
Correct |
2 ms |
14684 KB |
Output is correct |
76 |
Correct |
2 ms |
14744 KB |
Output is correct |
77 |
Correct |
2 ms |
14680 KB |
Output is correct |
78 |
Correct |
3 ms |
14684 KB |
Output is correct |
79 |
Correct |
2 ms |
14684 KB |
Output is correct |
80 |
Correct |
2 ms |
14684 KB |
Output is correct |
81 |
Correct |
2 ms |
14684 KB |
Output is correct |
82 |
Correct |
2 ms |
14684 KB |
Output is correct |
83 |
Correct |
2 ms |
14684 KB |
Output is correct |
84 |
Correct |
2 ms |
14684 KB |
Output is correct |
85 |
Correct |
3 ms |
14684 KB |
Output is correct |
86 |
Correct |
3 ms |
14684 KB |
Output is correct |
87 |
Correct |
2 ms |
14684 KB |
Output is correct |
88 |
Correct |
2 ms |
14684 KB |
Output is correct |
89 |
Correct |
2 ms |
14816 KB |
Output is correct |
90 |
Correct |
2 ms |
14684 KB |
Output is correct |
91 |
Correct |
2 ms |
14684 KB |
Output is correct |
92 |
Correct |
3 ms |
14684 KB |
Output is correct |
93 |
Correct |
2 ms |
14684 KB |
Output is correct |
94 |
Correct |
3 ms |
14684 KB |
Output is correct |
95 |
Correct |
3 ms |
14684 KB |
Output is correct |
96 |
Correct |
2 ms |
14680 KB |
Output is correct |
97 |
Correct |
2 ms |
14680 KB |
Output is correct |
98 |
Correct |
3 ms |
14684 KB |
Output is correct |
99 |
Correct |
2 ms |
14684 KB |
Output is correct |
100 |
Correct |
3 ms |
14680 KB |
Output is correct |
101 |
Correct |
2 ms |
14684 KB |
Output is correct |
102 |
Correct |
2 ms |
14684 KB |
Output is correct |
103 |
Correct |
2 ms |
14684 KB |
Output is correct |
104 |
Correct |
2 ms |
14684 KB |
Output is correct |
105 |
Correct |
2 ms |
14684 KB |
Output is correct |
106 |
Correct |
2 ms |
14684 KB |
Output is correct |
107 |
Correct |
4 ms |
14680 KB |
Output is correct |
108 |
Correct |
3 ms |
14684 KB |
Output is correct |
109 |
Correct |
4 ms |
14836 KB |
Output is correct |
110 |
Correct |
3 ms |
14680 KB |
Output is correct |
111 |
Correct |
3 ms |
14684 KB |
Output is correct |
112 |
Correct |
3 ms |
14940 KB |
Output is correct |
113 |
Correct |
4 ms |
15068 KB |
Output is correct |
114 |
Correct |
3 ms |
14940 KB |
Output is correct |
115 |
Correct |
3 ms |
14940 KB |
Output is correct |
116 |
Correct |
3 ms |
14940 KB |
Output is correct |
117 |
Correct |
4 ms |
14936 KB |
Output is correct |
118 |
Correct |
17 ms |
17788 KB |
Output is correct |
119 |
Correct |
13 ms |
18268 KB |
Output is correct |
120 |
Correct |
19 ms |
18780 KB |
Output is correct |
121 |
Correct |
6 ms |
14684 KB |
Output is correct |
122 |
Correct |
7 ms |
14684 KB |
Output is correct |
123 |
Correct |
6 ms |
14856 KB |
Output is correct |
124 |
Correct |
6 ms |
14684 KB |
Output is correct |
125 |
Correct |
6 ms |
14684 KB |
Output is correct |
126 |
Correct |
5 ms |
14940 KB |
Output is correct |
127 |
Correct |
4 ms |
14940 KB |
Output is correct |
128 |
Correct |
4 ms |
14940 KB |
Output is correct |
129 |
Correct |
4 ms |
14940 KB |
Output is correct |
130 |
Correct |
4 ms |
15120 KB |
Output is correct |
131 |
Correct |
4 ms |
14940 KB |
Output is correct |
132 |
Correct |
26 ms |
19036 KB |
Output is correct |
133 |
Correct |
20 ms |
19036 KB |
Output is correct |
134 |
Correct |
19 ms |
18944 KB |
Output is correct |
135 |
Correct |
5 ms |
14936 KB |
Output is correct |
136 |
Correct |
439 ms |
15064 KB |
Output is correct |
137 |
Correct |
306 ms |
15044 KB |
Output is correct |
138 |
Correct |
238 ms |
15052 KB |
Output is correct |
139 |
Correct |
301 ms |
15116 KB |
Output is correct |
140 |
Correct |
214 ms |
14940 KB |
Output is correct |
141 |
Correct |
14 ms |
16216 KB |
Output is correct |
142 |
Correct |
12 ms |
16120 KB |
Output is correct |
143 |
Correct |
17 ms |
16476 KB |
Output is correct |
144 |
Correct |
13 ms |
16220 KB |
Output is correct |
145 |
Correct |
15 ms |
16348 KB |
Output is correct |
146 |
Correct |
15 ms |
15960 KB |
Output is correct |
147 |
Correct |
17 ms |
17692 KB |
Output is correct |
148 |
Correct |
9 ms |
15452 KB |
Output is correct |
149 |
Correct |
20 ms |
18012 KB |
Output is correct |
150 |
Correct |
8 ms |
15368 KB |
Output is correct |
151 |
Correct |
22 ms |
18524 KB |
Output is correct |
152 |
Correct |
11 ms |
15636 KB |
Output is correct |
153 |
Correct |
8 ms |
15708 KB |
Output is correct |
154 |
Correct |
9 ms |
15992 KB |
Output is correct |
155 |
Correct |
7 ms |
15620 KB |
Output is correct |
156 |
Correct |
7 ms |
15708 KB |
Output is correct |
157 |
Correct |
6 ms |
15116 KB |
Output is correct |
158 |
Correct |
632 ms |
15140 KB |
Output is correct |
159 |
Correct |
561 ms |
15184 KB |
Output is correct |
160 |
Correct |
548 ms |
15196 KB |
Output is correct |
161 |
Correct |
521 ms |
15204 KB |
Output is correct |
162 |
Correct |
458 ms |
15196 KB |
Output is correct |
163 |
Correct |
27 ms |
16732 KB |
Output is correct |
164 |
Correct |
21 ms |
16732 KB |
Output is correct |
165 |
Correct |
21 ms |
16732 KB |
Output is correct |
166 |
Correct |
21 ms |
16732 KB |
Output is correct |
167 |
Correct |
22 ms |
16732 KB |
Output is correct |
168 |
Correct |
21 ms |
16864 KB |
Output is correct |
169 |
Correct |
27 ms |
19544 KB |
Output is correct |
170 |
Correct |
14 ms |
15708 KB |
Output is correct |
171 |
Correct |
26 ms |
19656 KB |
Output is correct |
172 |
Correct |
15 ms |
15708 KB |
Output is correct |
173 |
Correct |
28 ms |
19612 KB |
Output is correct |
174 |
Correct |
15 ms |
15704 KB |
Output is correct |
175 |
Correct |
10 ms |
16220 KB |
Output is correct |
176 |
Correct |
9 ms |
16024 KB |
Output is correct |
177 |
Correct |
9 ms |
15964 KB |
Output is correct |
178 |
Correct |
9 ms |
15904 KB |
Output is correct |
179 |
Correct |
14 ms |
17756 KB |
Output is correct |
180 |
Correct |
1228 ms |
17644 KB |
Output is correct |
181 |
Execution timed out |
1571 ms |
15964 KB |
Time limit exceeded |
182 |
Halted |
0 ms |
0 KB |
- |