#include<bits/stdc++.h>
using namespace std;
#define inf 0x3f3f3f3f
#define sz(x) int((x).size())
#define fi first
#define se second
typedef long long ll;
typedef pair<int, int> ii;
template<class X, class Y>
inline bool maximize(X &x, const Y &y) {return (x < y ? x = y, 1 : 0);}
template<class X, class Y>
inline bool minimize(X &x, const Y &y) {return (x > y ? x = y, 1 : 0);}
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
int Random(int l, int r) {
return uniform_int_distribution<int>(l, r)(rng);
}
const int MAXN = 100005;
const int MAXM = 50004;
vector<ii> D[MAXN];
vector<int> B[MAXM], C[MAXN];
int dp[2 * MAXN], sum[MAXN], *f[MAXN];
int colNeed[MAXN], nArr, mArr, numCol;
bool dx[2003][MAXN], ok[MAXN];
int sub1(void) {
for (int i = 1; i <= nArr; ++i) {
if(sz(C[colNeed[i]]) == 0)
return -1;
dp[i] = C[colNeed[i]][0];
sum[i] = sum[i - 1] + (i > 1 && (dp[i - 1] + 1) % mArr == dp[i]);
}
int res(0), maxi(1), lastok(-mArr);
for (int i = 1; i <= nArr; ++i) {
if(sum[i + mArr - 1] - sum[i] == mArr - 1 && (dp[i + mArr - 1] + 1) % mArr == dp[i])
lastok = i;
if(i == maxi) {
if(lastok + mArr <= i)
return -1;
maxi = lastok + mArr;
++res;
}
}
return res;
}
int sub3(void) {
for (int j = 0; j < mArr; ++j) {
for (int it = 0; it < sz(B[j]); ++it)
dx[j][B[j][it]] = 1;
}
for (int i = 1; i + mArr - 1 <= nArr; ++i) {
ok[i] = 0;
for (int j = 0; j < mArr; ++j) {
ok[i] = 1;
for (int k = 0; k < mArr; ++k)
ok[i] &= (dx[(j + k) % mArr][colNeed[i + k]]);
if(ok[i])
break;
}
}
int res(0), maxi(1), lastok(-mArr);
for (int i = 1; i <= nArr; ++i) {
if(ok[i])
lastok = i;
if(i == maxi) {
if(lastok + mArr <= i)
return -1;
maxi = lastok + mArr;
++res;
}
}
return res;
}
int sub4(void) {
for (int j = 0; j < mArr; ++j) {
for (int it = 0; it < sz(B[j]); ++it)
dx[j][B[j][it]] = 1;
}
for (int i = 0; i <= nArr + 1; ++i) {
f[i] = new int[mArr + 2];
for (int j = 0; j <= mArr + 1; ++j)
f[i][j] = 0;
}
for (int i = nArr; i > 0; --i) {
for (int j = mArr; j > 0; --j)
f[i][j] = f[i + 1][j + 1] + (dx[j - 1][colNeed[i]]);
}
for (int i = 1; i + mArr - 1 <= nArr; ++i) {
for (int j = 0; j < mArr; ++j) {
ok[i] = (f[i][j + 1] + f[i + mArr - j][1] - f[i + mArr][j + 1] == mArr);
if(ok[i])
break;
}
}
int res(0), maxi(1), lastok(-mArr);
for (int i = 1; i <= nArr; ++i) {
if(ok[i])
lastok = i;
if(i == maxi) {
if(lastok + mArr <= i)
return -1;
maxi = lastok + mArr;
++res;
}
}
return res;
}
queue<ii> qu[MAXN];
int magicFunc(void) {
for (int i = 1; i <= nArr; ++i)
sort(C[colNeed[i]].begin(), C[colNeed[i]].end());
for (int i = 1; i + mArr - 1 <= nArr; ++i) {
f[i] = new int[sz(C[colNeed[i]])];
int k(0);
while(k < sz(C[colNeed[i]]) && i - C[colNeed[i]][k] + mArr > nArr)
++k;
if(k < sz(C[colNeed[i]])) {
int id(C[colNeed[i]][k]);
qu[i - id + mArr].push(ii(i, k));
}
for (int it = 0; it < sz(C[colNeed[i]]); ++it)
f[i][it] = 0;
}
for (int i = 0; i <= nArr + mArr; ++i)
dp[i] = 0;
for (int i = nArr; i > 0; --i) {
for (int j = 0; j < sz(C[colNeed[i]]); ++j) {
int id(C[colNeed[i]][j]);
++dp[i - id + mArr];
}
if(i + mArr - 1 <= nArr) {
for (int it = 0; it < sz(C[colNeed[i]]); ++it) {
int id(C[colNeed[i]][it]);
f[i][it] += dp[i - id + mArr];
}
}
if(i > mArr) {
for (int it = 0; it < sz(C[colNeed[i - mArr]]); ++it) {
int id(C[colNeed[i - mArr]][it]);
f[i - mArr][it] -= dp[i - id + mArr];
}
}
while(sz(qu[i])) {
int j(qu[i].front().fi), k(qu[i].front().se);
qu[i].pop();
f[j][k] += dp[i + mArr];
if(++k < sz(C[colNeed[j]])) {
int id(C[colNeed[j]][k]);
qu[j - id + mArr].push(ii(j, k));
}
}
}
for (int i = 1; i + mArr - 1 <= nArr; ++i) {
for (int it = 0; it < sz(C[colNeed[i]]); ++it)
ok[i] |= (f[i][it] == mArr);
}
int res(0), maxi(1), lastok(-mArr);
for (int i = 1; i <= nArr; ++i) {
if(ok[i])
lastok = i;
if(i == maxi) {
if(lastok + mArr <= i)
return -1;
maxi = lastok + mArr;
++res;
}
}
return res;
}
int minimumInstructions(int _N, int _M, int _K, vector<int> _C, vector<int> _A, vector<vector<int>> _B) {
nArr = _N, mArr = _M, numCol = _K;
for (int i = 1; i <= nArr; ++i) {
colNeed[i] = _C[i - 1];
C[i].clear();
}
int maxf(0);
for (int i = 0; i < mArr; ++i) {
int szlike(_A[i]);
B[i].clear();
for (int j = 0; j < szlike; ++j) {
B[i].push_back(_B[i][j]);
C[_B[i][j]].push_back(i);
maxf = max(maxf, sz(C[_B[i][j]]));
}
}
/*if(maxf <= 1)
return sub1();
if(nArr <= 500)
return sub3();
if(nArr <= 20000 && mArr <= 2000)
return sub4();*/
return magicFunc();
}
#ifdef Nhoksocqt1
int main(void) {
ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
#define TASK "paint"
if(fopen(TASK".inp", "r")) {
freopen(TASK".inp", "r", stdin);
freopen(TASK".out", "w", stdout);
}
vector<int> _A, _C;
vector<vector<int>> _B;
int _N, _M, _K;
cin >> _N >> _M >> _K;
_C.resize(_N);
for (int i = 0; i < _N; ++i) {
cin >> _C[i];
//_C[i] = Random(0, _K - 1); cout << _C[i] << " \n"[i + 1 == _N];
}
vector<int> col; for (int i = 0; i < _K; ++i) col.push_back(i);
_A.resize(_M), _B.resize(_M);
for (int i = 0; i < _M; ++i) {
cin >> _A[i];
//_A[i] = Random(1, _K); cout << _A[i] << ' ';
_B[i].resize(_A[i]);
shuffle(col.begin(), col.end(), rng);
for (int j = 0; j < _A[i]; ++j) {
cin >> _B[i][j];
//_B[i][j] = col[j]; cout << _B[i][j] << " \n"[j + 1 == _A[i]];
}
}
int ans = minimumInstructions(_N, _M, _K, _C, _A, _B);
cout << "ANSWER: " << ans << '\n';
return 0;
}
#endif // Nhoksocqt1
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
76884 KB |
Output is correct |
2 |
Correct |
33 ms |
76888 KB |
Output is correct |
3 |
Correct |
35 ms |
77148 KB |
Output is correct |
4 |
Correct |
34 ms |
76944 KB |
Output is correct |
5 |
Correct |
34 ms |
77000 KB |
Output is correct |
6 |
Correct |
34 ms |
77100 KB |
Output is correct |
7 |
Correct |
34 ms |
77148 KB |
Output is correct |
8 |
Correct |
33 ms |
77144 KB |
Output is correct |
9 |
Correct |
35 ms |
77060 KB |
Output is correct |
10 |
Correct |
34 ms |
77148 KB |
Output is correct |
11 |
Correct |
35 ms |
77144 KB |
Output is correct |
12 |
Correct |
35 ms |
77148 KB |
Output is correct |
13 |
Correct |
35 ms |
76964 KB |
Output is correct |
14 |
Correct |
34 ms |
77148 KB |
Output is correct |
15 |
Correct |
35 ms |
77140 KB |
Output is correct |
16 |
Correct |
36 ms |
77144 KB |
Output is correct |
17 |
Correct |
34 ms |
77148 KB |
Output is correct |
18 |
Correct |
34 ms |
77148 KB |
Output is correct |
19 |
Correct |
37 ms |
77148 KB |
Output is correct |
20 |
Correct |
34 ms |
77144 KB |
Output is correct |
21 |
Correct |
34 ms |
77340 KB |
Output is correct |
22 |
Correct |
51 ms |
81500 KB |
Output is correct |
23 |
Correct |
51 ms |
81500 KB |
Output is correct |
24 |
Correct |
52 ms |
81500 KB |
Output is correct |
25 |
Correct |
37 ms |
77904 KB |
Output is correct |
26 |
Correct |
38 ms |
77916 KB |
Output is correct |
27 |
Correct |
37 ms |
77900 KB |
Output is correct |
28 |
Correct |
38 ms |
77920 KB |
Output is correct |
29 |
Correct |
38 ms |
78168 KB |
Output is correct |
30 |
Correct |
40 ms |
77652 KB |
Output is correct |
31 |
Correct |
42 ms |
78940 KB |
Output is correct |
32 |
Correct |
42 ms |
78876 KB |
Output is correct |
33 |
Correct |
43 ms |
78936 KB |
Output is correct |
34 |
Correct |
42 ms |
78936 KB |
Output is correct |
35 |
Correct |
42 ms |
78928 KB |
Output is correct |
36 |
Correct |
43 ms |
78928 KB |
Output is correct |
37 |
Correct |
58 ms |
82260 KB |
Output is correct |
38 |
Correct |
59 ms |
82716 KB |
Output is correct |
39 |
Correct |
61 ms |
82428 KB |
Output is correct |
40 |
Correct |
49 ms |
80472 KB |
Output is correct |
41 |
Correct |
43 ms |
79124 KB |
Output is correct |
42 |
Correct |
53 ms |
80976 KB |
Output is correct |
43 |
Correct |
47 ms |
79696 KB |
Output is correct |
44 |
Correct |
56 ms |
79440 KB |
Output is correct |
45 |
Correct |
56 ms |
80900 KB |
Output is correct |
46 |
Correct |
71 ms |
89172 KB |
Output is correct |
47 |
Correct |
59 ms |
84048 KB |
Output is correct |
48 |
Correct |
64 ms |
86440 KB |
Output is correct |
49 |
Correct |
79 ms |
86612 KB |
Output is correct |
50 |
Correct |
74 ms |
86688 KB |
Output is correct |
51 |
Correct |
76 ms |
84564 KB |
Output is correct |
52 |
Correct |
50 ms |
80888 KB |
Output is correct |
53 |
Correct |
51 ms |
80980 KB |
Output is correct |
54 |
Correct |
54 ms |
81048 KB |
Output is correct |
55 |
Correct |
59 ms |
80980 KB |
Output is correct |
56 |
Correct |
57 ms |
80976 KB |
Output is correct |
57 |
Correct |
55 ms |
80976 KB |
Output is correct |
58 |
Correct |
77 ms |
90348 KB |
Output is correct |
59 |
Correct |
75 ms |
90412 KB |
Output is correct |
60 |
Correct |
87 ms |
90452 KB |
Output is correct |
61 |
Correct |
77 ms |
90452 KB |
Output is correct |
62 |
Correct |
75 ms |
90268 KB |
Output is correct |
63 |
Correct |
77 ms |
90448 KB |
Output is correct |
64 |
Correct |
91 ms |
89196 KB |
Output is correct |
65 |
Correct |
90 ms |
89248 KB |
Output is correct |
66 |
Correct |
90 ms |
89172 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
34 ms |
76884 KB |
Output is correct |
2 |
Correct |
33 ms |
76888 KB |
Output is correct |
3 |
Correct |
35 ms |
77148 KB |
Output is correct |
4 |
Correct |
34 ms |
76944 KB |
Output is correct |
5 |
Correct |
34 ms |
77000 KB |
Output is correct |
6 |
Correct |
34 ms |
77100 KB |
Output is correct |
7 |
Correct |
34 ms |
77148 KB |
Output is correct |
8 |
Correct |
33 ms |
77144 KB |
Output is correct |
9 |
Correct |
35 ms |
77060 KB |
Output is correct |
10 |
Correct |
34 ms |
77148 KB |
Output is correct |
11 |
Correct |
35 ms |
77144 KB |
Output is correct |
12 |
Correct |
35 ms |
77148 KB |
Output is correct |
13 |
Correct |
35 ms |
76964 KB |
Output is correct |
14 |
Correct |
34 ms |
77148 KB |
Output is correct |
15 |
Correct |
35 ms |
77140 KB |
Output is correct |
16 |
Correct |
36 ms |
77144 KB |
Output is correct |
17 |
Correct |
34 ms |
77148 KB |
Output is correct |
18 |
Correct |
34 ms |
77148 KB |
Output is correct |
19 |
Correct |
37 ms |
77148 KB |
Output is correct |
20 |
Correct |
34 ms |
77144 KB |
Output is correct |
21 |
Correct |
34 ms |
77340 KB |
Output is correct |
22 |
Correct |
35 ms |
76920 KB |
Output is correct |
23 |
Correct |
35 ms |
77148 KB |
Output is correct |
24 |
Correct |
38 ms |
76892 KB |
Output is correct |
25 |
Correct |
34 ms |
76884 KB |
Output is correct |
26 |
Correct |
35 ms |
76892 KB |
Output is correct |
27 |
Correct |
35 ms |
76880 KB |
Output is correct |
28 |
Correct |
34 ms |
77148 KB |
Output is correct |
29 |
Correct |
35 ms |
77148 KB |
Output is correct |
30 |
Correct |
34 ms |
77104 KB |
Output is correct |
31 |
Correct |
34 ms |
77144 KB |
Output is correct |
32 |
Correct |
35 ms |
77136 KB |
Output is correct |
33 |
Correct |
35 ms |
77136 KB |
Output is correct |
34 |
Correct |
36 ms |
77148 KB |
Output is correct |
35 |
Correct |
34 ms |
77136 KB |
Output is correct |
36 |
Correct |
34 ms |
77144 KB |
Output is correct |
37 |
Correct |
37 ms |
77148 KB |
Output is correct |
38 |
Correct |
41 ms |
77392 KB |
Output is correct |
39 |
Correct |
35 ms |
77136 KB |
Output is correct |
40 |
Correct |
36 ms |
77188 KB |
Output is correct |
41 |
Correct |
38 ms |
77144 KB |
Output is correct |
42 |
Correct |
41 ms |
77136 KB |
Output is correct |
43 |
Correct |
34 ms |
77020 KB |
Output is correct |
44 |
Correct |
35 ms |
77140 KB |
Output is correct |
45 |
Correct |
36 ms |
77148 KB |
Output is correct |
46 |
Correct |
35 ms |
77148 KB |
Output is correct |
47 |
Correct |
36 ms |
77148 KB |
Output is correct |
48 |
Correct |
35 ms |
77136 KB |
Output is correct |
49 |
Correct |
34 ms |
77148 KB |
Output is correct |
50 |
Correct |
35 ms |
77148 KB |
Output is correct |
51 |
Correct |
37 ms |
77176 KB |
Output is correct |
52 |
Correct |
34 ms |
77144 KB |
Output is correct |
53 |
Correct |
38 ms |
77136 KB |
Output is correct |
54 |
Correct |
35 ms |
77148 KB |
Output is correct |
55 |
Correct |
36 ms |
77164 KB |
Output is correct |
56 |
Correct |
35 ms |
76976 KB |
Output is correct |
57 |
Correct |
42 ms |
77148 KB |
Output is correct |
58 |
Correct |
34 ms |
77136 KB |
Output is correct |
59 |
Correct |
37 ms |
77148 KB |
Output is correct |
60 |
Correct |
36 ms |
77124 KB |
Output is correct |
61 |
Correct |
37 ms |
77172 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
76920 KB |
Output is correct |
2 |
Correct |
35 ms |
77148 KB |
Output is correct |
3 |
Correct |
34 ms |
76884 KB |
Output is correct |
4 |
Correct |
33 ms |
76888 KB |
Output is correct |
5 |
Correct |
35 ms |
77148 KB |
Output is correct |
6 |
Correct |
34 ms |
76944 KB |
Output is correct |
7 |
Correct |
34 ms |
77000 KB |
Output is correct |
8 |
Correct |
34 ms |
77100 KB |
Output is correct |
9 |
Correct |
34 ms |
77148 KB |
Output is correct |
10 |
Correct |
33 ms |
77144 KB |
Output is correct |
11 |
Correct |
35 ms |
77060 KB |
Output is correct |
12 |
Correct |
34 ms |
77148 KB |
Output is correct |
13 |
Correct |
35 ms |
77144 KB |
Output is correct |
14 |
Correct |
35 ms |
77148 KB |
Output is correct |
15 |
Correct |
35 ms |
76964 KB |
Output is correct |
16 |
Correct |
34 ms |
77148 KB |
Output is correct |
17 |
Correct |
35 ms |
77140 KB |
Output is correct |
18 |
Correct |
36 ms |
77144 KB |
Output is correct |
19 |
Correct |
34 ms |
77148 KB |
Output is correct |
20 |
Correct |
34 ms |
77148 KB |
Output is correct |
21 |
Correct |
37 ms |
77148 KB |
Output is correct |
22 |
Correct |
34 ms |
77144 KB |
Output is correct |
23 |
Correct |
34 ms |
77340 KB |
Output is correct |
24 |
Correct |
51 ms |
81500 KB |
Output is correct |
25 |
Correct |
51 ms |
81500 KB |
Output is correct |
26 |
Correct |
52 ms |
81500 KB |
Output is correct |
27 |
Correct |
38 ms |
76892 KB |
Output is correct |
28 |
Correct |
34 ms |
76884 KB |
Output is correct |
29 |
Correct |
35 ms |
76892 KB |
Output is correct |
30 |
Correct |
35 ms |
76880 KB |
Output is correct |
31 |
Correct |
34 ms |
77148 KB |
Output is correct |
32 |
Correct |
35 ms |
77148 KB |
Output is correct |
33 |
Correct |
34 ms |
77104 KB |
Output is correct |
34 |
Correct |
34 ms |
77144 KB |
Output is correct |
35 |
Correct |
35 ms |
77136 KB |
Output is correct |
36 |
Correct |
35 ms |
77136 KB |
Output is correct |
37 |
Correct |
36 ms |
77148 KB |
Output is correct |
38 |
Correct |
34 ms |
77136 KB |
Output is correct |
39 |
Correct |
34 ms |
77144 KB |
Output is correct |
40 |
Correct |
37 ms |
77148 KB |
Output is correct |
41 |
Correct |
41 ms |
77392 KB |
Output is correct |
42 |
Correct |
35 ms |
77136 KB |
Output is correct |
43 |
Correct |
36 ms |
77188 KB |
Output is correct |
44 |
Correct |
38 ms |
77144 KB |
Output is correct |
45 |
Correct |
41 ms |
77136 KB |
Output is correct |
46 |
Correct |
34 ms |
77020 KB |
Output is correct |
47 |
Correct |
35 ms |
77140 KB |
Output is correct |
48 |
Correct |
36 ms |
77148 KB |
Output is correct |
49 |
Correct |
35 ms |
77148 KB |
Output is correct |
50 |
Correct |
36 ms |
77148 KB |
Output is correct |
51 |
Correct |
35 ms |
77136 KB |
Output is correct |
52 |
Correct |
34 ms |
77148 KB |
Output is correct |
53 |
Correct |
35 ms |
77148 KB |
Output is correct |
54 |
Correct |
37 ms |
77176 KB |
Output is correct |
55 |
Correct |
34 ms |
77144 KB |
Output is correct |
56 |
Correct |
38 ms |
77136 KB |
Output is correct |
57 |
Correct |
35 ms |
77148 KB |
Output is correct |
58 |
Correct |
36 ms |
77164 KB |
Output is correct |
59 |
Correct |
35 ms |
76976 KB |
Output is correct |
60 |
Correct |
42 ms |
77148 KB |
Output is correct |
61 |
Correct |
34 ms |
77136 KB |
Output is correct |
62 |
Correct |
37 ms |
77148 KB |
Output is correct |
63 |
Correct |
36 ms |
77124 KB |
Output is correct |
64 |
Correct |
37 ms |
77172 KB |
Output is correct |
65 |
Correct |
42 ms |
77140 KB |
Output is correct |
66 |
Correct |
36 ms |
77144 KB |
Output is correct |
67 |
Correct |
36 ms |
77132 KB |
Output is correct |
68 |
Correct |
44 ms |
77456 KB |
Output is correct |
69 |
Correct |
40 ms |
77140 KB |
Output is correct |
70 |
Correct |
35 ms |
77332 KB |
Output is correct |
71 |
Correct |
39 ms |
77400 KB |
Output is correct |
72 |
Correct |
41 ms |
77388 KB |
Output is correct |
73 |
Correct |
34 ms |
77140 KB |
Output is correct |
74 |
Correct |
43 ms |
77392 KB |
Output is correct |
75 |
Correct |
36 ms |
77208 KB |
Output is correct |
76 |
Correct |
57 ms |
80724 KB |
Output is correct |
77 |
Correct |
48 ms |
81104 KB |
Output is correct |
78 |
Correct |
59 ms |
82004 KB |
Output is correct |
79 |
Correct |
38 ms |
77396 KB |
Output is correct |
80 |
Correct |
42 ms |
77404 KB |
Output is correct |
81 |
Correct |
41 ms |
77232 KB |
Output is correct |
82 |
Correct |
36 ms |
77276 KB |
Output is correct |
83 |
Correct |
37 ms |
77248 KB |
Output is correct |
84 |
Correct |
37 ms |
77384 KB |
Output is correct |
85 |
Correct |
37 ms |
77404 KB |
Output is correct |
86 |
Correct |
42 ms |
77532 KB |
Output is correct |
87 |
Correct |
37 ms |
77392 KB |
Output is correct |
88 |
Correct |
37 ms |
77404 KB |
Output is correct |
89 |
Correct |
46 ms |
77572 KB |
Output is correct |
90 |
Correct |
56 ms |
82260 KB |
Output is correct |
91 |
Correct |
57 ms |
82272 KB |
Output is correct |
92 |
Correct |
58 ms |
82428 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
76920 KB |
Output is correct |
2 |
Correct |
35 ms |
77148 KB |
Output is correct |
3 |
Correct |
34 ms |
76884 KB |
Output is correct |
4 |
Correct |
33 ms |
76888 KB |
Output is correct |
5 |
Correct |
35 ms |
77148 KB |
Output is correct |
6 |
Correct |
34 ms |
76944 KB |
Output is correct |
7 |
Correct |
34 ms |
77000 KB |
Output is correct |
8 |
Correct |
34 ms |
77100 KB |
Output is correct |
9 |
Correct |
34 ms |
77148 KB |
Output is correct |
10 |
Correct |
33 ms |
77144 KB |
Output is correct |
11 |
Correct |
35 ms |
77060 KB |
Output is correct |
12 |
Correct |
34 ms |
77148 KB |
Output is correct |
13 |
Correct |
35 ms |
77144 KB |
Output is correct |
14 |
Correct |
35 ms |
77148 KB |
Output is correct |
15 |
Correct |
35 ms |
76964 KB |
Output is correct |
16 |
Correct |
34 ms |
77148 KB |
Output is correct |
17 |
Correct |
35 ms |
77140 KB |
Output is correct |
18 |
Correct |
36 ms |
77144 KB |
Output is correct |
19 |
Correct |
34 ms |
77148 KB |
Output is correct |
20 |
Correct |
34 ms |
77148 KB |
Output is correct |
21 |
Correct |
37 ms |
77148 KB |
Output is correct |
22 |
Correct |
34 ms |
77144 KB |
Output is correct |
23 |
Correct |
34 ms |
77340 KB |
Output is correct |
24 |
Correct |
51 ms |
81500 KB |
Output is correct |
25 |
Correct |
51 ms |
81500 KB |
Output is correct |
26 |
Correct |
52 ms |
81500 KB |
Output is correct |
27 |
Correct |
37 ms |
77904 KB |
Output is correct |
28 |
Correct |
38 ms |
77916 KB |
Output is correct |
29 |
Correct |
37 ms |
77900 KB |
Output is correct |
30 |
Correct |
38 ms |
77920 KB |
Output is correct |
31 |
Correct |
38 ms |
78168 KB |
Output is correct |
32 |
Correct |
40 ms |
77652 KB |
Output is correct |
33 |
Correct |
42 ms |
78940 KB |
Output is correct |
34 |
Correct |
42 ms |
78876 KB |
Output is correct |
35 |
Correct |
43 ms |
78936 KB |
Output is correct |
36 |
Correct |
42 ms |
78936 KB |
Output is correct |
37 |
Correct |
42 ms |
78928 KB |
Output is correct |
38 |
Correct |
43 ms |
78928 KB |
Output is correct |
39 |
Correct |
58 ms |
82260 KB |
Output is correct |
40 |
Correct |
59 ms |
82716 KB |
Output is correct |
41 |
Correct |
61 ms |
82428 KB |
Output is correct |
42 |
Correct |
38 ms |
76892 KB |
Output is correct |
43 |
Correct |
34 ms |
76884 KB |
Output is correct |
44 |
Correct |
35 ms |
76892 KB |
Output is correct |
45 |
Correct |
35 ms |
76880 KB |
Output is correct |
46 |
Correct |
34 ms |
77148 KB |
Output is correct |
47 |
Correct |
35 ms |
77148 KB |
Output is correct |
48 |
Correct |
34 ms |
77104 KB |
Output is correct |
49 |
Correct |
34 ms |
77144 KB |
Output is correct |
50 |
Correct |
35 ms |
77136 KB |
Output is correct |
51 |
Correct |
35 ms |
77136 KB |
Output is correct |
52 |
Correct |
36 ms |
77148 KB |
Output is correct |
53 |
Correct |
34 ms |
77136 KB |
Output is correct |
54 |
Correct |
34 ms |
77144 KB |
Output is correct |
55 |
Correct |
37 ms |
77148 KB |
Output is correct |
56 |
Correct |
41 ms |
77392 KB |
Output is correct |
57 |
Correct |
35 ms |
77136 KB |
Output is correct |
58 |
Correct |
36 ms |
77188 KB |
Output is correct |
59 |
Correct |
38 ms |
77144 KB |
Output is correct |
60 |
Correct |
41 ms |
77136 KB |
Output is correct |
61 |
Correct |
34 ms |
77020 KB |
Output is correct |
62 |
Correct |
35 ms |
77140 KB |
Output is correct |
63 |
Correct |
36 ms |
77148 KB |
Output is correct |
64 |
Correct |
35 ms |
77148 KB |
Output is correct |
65 |
Correct |
36 ms |
77148 KB |
Output is correct |
66 |
Correct |
35 ms |
77136 KB |
Output is correct |
67 |
Correct |
34 ms |
77148 KB |
Output is correct |
68 |
Correct |
35 ms |
77148 KB |
Output is correct |
69 |
Correct |
37 ms |
77176 KB |
Output is correct |
70 |
Correct |
34 ms |
77144 KB |
Output is correct |
71 |
Correct |
38 ms |
77136 KB |
Output is correct |
72 |
Correct |
35 ms |
77148 KB |
Output is correct |
73 |
Correct |
36 ms |
77164 KB |
Output is correct |
74 |
Correct |
35 ms |
76976 KB |
Output is correct |
75 |
Correct |
42 ms |
77148 KB |
Output is correct |
76 |
Correct |
34 ms |
77136 KB |
Output is correct |
77 |
Correct |
37 ms |
77148 KB |
Output is correct |
78 |
Correct |
36 ms |
77124 KB |
Output is correct |
79 |
Correct |
37 ms |
77172 KB |
Output is correct |
80 |
Correct |
42 ms |
77140 KB |
Output is correct |
81 |
Correct |
36 ms |
77144 KB |
Output is correct |
82 |
Correct |
36 ms |
77132 KB |
Output is correct |
83 |
Correct |
44 ms |
77456 KB |
Output is correct |
84 |
Correct |
40 ms |
77140 KB |
Output is correct |
85 |
Correct |
35 ms |
77332 KB |
Output is correct |
86 |
Correct |
39 ms |
77400 KB |
Output is correct |
87 |
Correct |
41 ms |
77388 KB |
Output is correct |
88 |
Correct |
34 ms |
77140 KB |
Output is correct |
89 |
Correct |
43 ms |
77392 KB |
Output is correct |
90 |
Correct |
36 ms |
77208 KB |
Output is correct |
91 |
Correct |
57 ms |
80724 KB |
Output is correct |
92 |
Correct |
48 ms |
81104 KB |
Output is correct |
93 |
Correct |
59 ms |
82004 KB |
Output is correct |
94 |
Correct |
38 ms |
77396 KB |
Output is correct |
95 |
Correct |
42 ms |
77404 KB |
Output is correct |
96 |
Correct |
41 ms |
77232 KB |
Output is correct |
97 |
Correct |
36 ms |
77276 KB |
Output is correct |
98 |
Correct |
37 ms |
77248 KB |
Output is correct |
99 |
Correct |
37 ms |
77384 KB |
Output is correct |
100 |
Correct |
37 ms |
77404 KB |
Output is correct |
101 |
Correct |
42 ms |
77532 KB |
Output is correct |
102 |
Correct |
37 ms |
77392 KB |
Output is correct |
103 |
Correct |
37 ms |
77404 KB |
Output is correct |
104 |
Correct |
46 ms |
77572 KB |
Output is correct |
105 |
Correct |
56 ms |
82260 KB |
Output is correct |
106 |
Correct |
57 ms |
82272 KB |
Output is correct |
107 |
Correct |
58 ms |
82428 KB |
Output is correct |
108 |
Correct |
37 ms |
77912 KB |
Output is correct |
109 |
Correct |
268 ms |
113236 KB |
Output is correct |
110 |
Correct |
158 ms |
97200 KB |
Output is correct |
111 |
Correct |
131 ms |
90960 KB |
Output is correct |
112 |
Correct |
147 ms |
92756 KB |
Output is correct |
113 |
Correct |
104 ms |
87100 KB |
Output is correct |
114 |
Correct |
46 ms |
79188 KB |
Output is correct |
115 |
Correct |
48 ms |
79196 KB |
Output is correct |
116 |
Correct |
52 ms |
79948 KB |
Output is correct |
117 |
Correct |
53 ms |
79256 KB |
Output is correct |
118 |
Correct |
49 ms |
79368 KB |
Output is correct |
119 |
Correct |
44 ms |
79180 KB |
Output is correct |
120 |
Correct |
52 ms |
80720 KB |
Output is correct |
121 |
Correct |
45 ms |
78172 KB |
Output is correct |
122 |
Correct |
54 ms |
80976 KB |
Output is correct |
123 |
Correct |
43 ms |
77908 KB |
Output is correct |
124 |
Correct |
60 ms |
82004 KB |
Output is correct |
125 |
Correct |
49 ms |
78676 KB |
Output is correct |
126 |
Correct |
41 ms |
78740 KB |
Output is correct |
127 |
Correct |
43 ms |
79184 KB |
Output is correct |
128 |
Correct |
40 ms |
78416 KB |
Output is correct |
129 |
Correct |
41 ms |
78428 KB |
Output is correct |
130 |
Correct |
38 ms |
77800 KB |
Output is correct |
131 |
Correct |
352 ms |
128588 KB |
Output is correct |
132 |
Correct |
288 ms |
114124 KB |
Output is correct |
133 |
Correct |
262 ms |
107720 KB |
Output is correct |
134 |
Correct |
214 ms |
102344 KB |
Output is correct |
135 |
Correct |
216 ms |
98384 KB |
Output is correct |
136 |
Correct |
57 ms |
80460 KB |
Output is correct |
137 |
Correct |
61 ms |
80460 KB |
Output is correct |
138 |
Correct |
56 ms |
80452 KB |
Output is correct |
139 |
Correct |
56 ms |
80400 KB |
Output is correct |
140 |
Correct |
54 ms |
80252 KB |
Output is correct |
141 |
Correct |
56 ms |
80212 KB |
Output is correct |
142 |
Correct |
65 ms |
83452 KB |
Output is correct |
143 |
Correct |
48 ms |
78940 KB |
Output is correct |
144 |
Correct |
70 ms |
83284 KB |
Output is correct |
145 |
Correct |
48 ms |
78932 KB |
Output is correct |
146 |
Correct |
77 ms |
83288 KB |
Output is correct |
147 |
Correct |
48 ms |
78924 KB |
Output is correct |
148 |
Correct |
46 ms |
79236 KB |
Output is correct |
149 |
Correct |
43 ms |
79184 KB |
Output is correct |
150 |
Correct |
43 ms |
79184 KB |
Output is correct |
151 |
Correct |
53 ms |
79116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
35 ms |
76920 KB |
Output is correct |
2 |
Correct |
35 ms |
77148 KB |
Output is correct |
3 |
Correct |
34 ms |
76884 KB |
Output is correct |
4 |
Correct |
33 ms |
76888 KB |
Output is correct |
5 |
Correct |
35 ms |
77148 KB |
Output is correct |
6 |
Correct |
34 ms |
76944 KB |
Output is correct |
7 |
Correct |
34 ms |
77000 KB |
Output is correct |
8 |
Correct |
34 ms |
77100 KB |
Output is correct |
9 |
Correct |
34 ms |
77148 KB |
Output is correct |
10 |
Correct |
33 ms |
77144 KB |
Output is correct |
11 |
Correct |
35 ms |
77060 KB |
Output is correct |
12 |
Correct |
34 ms |
77148 KB |
Output is correct |
13 |
Correct |
35 ms |
77144 KB |
Output is correct |
14 |
Correct |
35 ms |
77148 KB |
Output is correct |
15 |
Correct |
35 ms |
76964 KB |
Output is correct |
16 |
Correct |
34 ms |
77148 KB |
Output is correct |
17 |
Correct |
35 ms |
77140 KB |
Output is correct |
18 |
Correct |
36 ms |
77144 KB |
Output is correct |
19 |
Correct |
34 ms |
77148 KB |
Output is correct |
20 |
Correct |
34 ms |
77148 KB |
Output is correct |
21 |
Correct |
37 ms |
77148 KB |
Output is correct |
22 |
Correct |
34 ms |
77144 KB |
Output is correct |
23 |
Correct |
34 ms |
77340 KB |
Output is correct |
24 |
Correct |
51 ms |
81500 KB |
Output is correct |
25 |
Correct |
51 ms |
81500 KB |
Output is correct |
26 |
Correct |
52 ms |
81500 KB |
Output is correct |
27 |
Correct |
37 ms |
77904 KB |
Output is correct |
28 |
Correct |
38 ms |
77916 KB |
Output is correct |
29 |
Correct |
37 ms |
77900 KB |
Output is correct |
30 |
Correct |
38 ms |
77920 KB |
Output is correct |
31 |
Correct |
38 ms |
78168 KB |
Output is correct |
32 |
Correct |
40 ms |
77652 KB |
Output is correct |
33 |
Correct |
42 ms |
78940 KB |
Output is correct |
34 |
Correct |
42 ms |
78876 KB |
Output is correct |
35 |
Correct |
43 ms |
78936 KB |
Output is correct |
36 |
Correct |
42 ms |
78936 KB |
Output is correct |
37 |
Correct |
42 ms |
78928 KB |
Output is correct |
38 |
Correct |
43 ms |
78928 KB |
Output is correct |
39 |
Correct |
58 ms |
82260 KB |
Output is correct |
40 |
Correct |
59 ms |
82716 KB |
Output is correct |
41 |
Correct |
61 ms |
82428 KB |
Output is correct |
42 |
Correct |
49 ms |
80472 KB |
Output is correct |
43 |
Correct |
43 ms |
79124 KB |
Output is correct |
44 |
Correct |
53 ms |
80976 KB |
Output is correct |
45 |
Correct |
47 ms |
79696 KB |
Output is correct |
46 |
Correct |
56 ms |
79440 KB |
Output is correct |
47 |
Correct |
56 ms |
80900 KB |
Output is correct |
48 |
Correct |
71 ms |
89172 KB |
Output is correct |
49 |
Correct |
59 ms |
84048 KB |
Output is correct |
50 |
Correct |
64 ms |
86440 KB |
Output is correct |
51 |
Correct |
79 ms |
86612 KB |
Output is correct |
52 |
Correct |
74 ms |
86688 KB |
Output is correct |
53 |
Correct |
76 ms |
84564 KB |
Output is correct |
54 |
Correct |
50 ms |
80888 KB |
Output is correct |
55 |
Correct |
51 ms |
80980 KB |
Output is correct |
56 |
Correct |
54 ms |
81048 KB |
Output is correct |
57 |
Correct |
59 ms |
80980 KB |
Output is correct |
58 |
Correct |
57 ms |
80976 KB |
Output is correct |
59 |
Correct |
55 ms |
80976 KB |
Output is correct |
60 |
Correct |
77 ms |
90348 KB |
Output is correct |
61 |
Correct |
75 ms |
90412 KB |
Output is correct |
62 |
Correct |
87 ms |
90452 KB |
Output is correct |
63 |
Correct |
77 ms |
90452 KB |
Output is correct |
64 |
Correct |
75 ms |
90268 KB |
Output is correct |
65 |
Correct |
77 ms |
90448 KB |
Output is correct |
66 |
Correct |
91 ms |
89196 KB |
Output is correct |
67 |
Correct |
90 ms |
89248 KB |
Output is correct |
68 |
Correct |
90 ms |
89172 KB |
Output is correct |
69 |
Correct |
38 ms |
76892 KB |
Output is correct |
70 |
Correct |
34 ms |
76884 KB |
Output is correct |
71 |
Correct |
35 ms |
76892 KB |
Output is correct |
72 |
Correct |
35 ms |
76880 KB |
Output is correct |
73 |
Correct |
34 ms |
77148 KB |
Output is correct |
74 |
Correct |
35 ms |
77148 KB |
Output is correct |
75 |
Correct |
34 ms |
77104 KB |
Output is correct |
76 |
Correct |
34 ms |
77144 KB |
Output is correct |
77 |
Correct |
35 ms |
77136 KB |
Output is correct |
78 |
Correct |
35 ms |
77136 KB |
Output is correct |
79 |
Correct |
36 ms |
77148 KB |
Output is correct |
80 |
Correct |
34 ms |
77136 KB |
Output is correct |
81 |
Correct |
34 ms |
77144 KB |
Output is correct |
82 |
Correct |
37 ms |
77148 KB |
Output is correct |
83 |
Correct |
41 ms |
77392 KB |
Output is correct |
84 |
Correct |
35 ms |
77136 KB |
Output is correct |
85 |
Correct |
36 ms |
77188 KB |
Output is correct |
86 |
Correct |
38 ms |
77144 KB |
Output is correct |
87 |
Correct |
41 ms |
77136 KB |
Output is correct |
88 |
Correct |
34 ms |
77020 KB |
Output is correct |
89 |
Correct |
35 ms |
77140 KB |
Output is correct |
90 |
Correct |
36 ms |
77148 KB |
Output is correct |
91 |
Correct |
35 ms |
77148 KB |
Output is correct |
92 |
Correct |
36 ms |
77148 KB |
Output is correct |
93 |
Correct |
35 ms |
77136 KB |
Output is correct |
94 |
Correct |
34 ms |
77148 KB |
Output is correct |
95 |
Correct |
35 ms |
77148 KB |
Output is correct |
96 |
Correct |
37 ms |
77176 KB |
Output is correct |
97 |
Correct |
34 ms |
77144 KB |
Output is correct |
98 |
Correct |
38 ms |
77136 KB |
Output is correct |
99 |
Correct |
35 ms |
77148 KB |
Output is correct |
100 |
Correct |
36 ms |
77164 KB |
Output is correct |
101 |
Correct |
35 ms |
76976 KB |
Output is correct |
102 |
Correct |
42 ms |
77148 KB |
Output is correct |
103 |
Correct |
34 ms |
77136 KB |
Output is correct |
104 |
Correct |
37 ms |
77148 KB |
Output is correct |
105 |
Correct |
36 ms |
77124 KB |
Output is correct |
106 |
Correct |
37 ms |
77172 KB |
Output is correct |
107 |
Correct |
42 ms |
77140 KB |
Output is correct |
108 |
Correct |
36 ms |
77144 KB |
Output is correct |
109 |
Correct |
36 ms |
77132 KB |
Output is correct |
110 |
Correct |
44 ms |
77456 KB |
Output is correct |
111 |
Correct |
40 ms |
77140 KB |
Output is correct |
112 |
Correct |
35 ms |
77332 KB |
Output is correct |
113 |
Correct |
39 ms |
77400 KB |
Output is correct |
114 |
Correct |
41 ms |
77388 KB |
Output is correct |
115 |
Correct |
34 ms |
77140 KB |
Output is correct |
116 |
Correct |
43 ms |
77392 KB |
Output is correct |
117 |
Correct |
36 ms |
77208 KB |
Output is correct |
118 |
Correct |
57 ms |
80724 KB |
Output is correct |
119 |
Correct |
48 ms |
81104 KB |
Output is correct |
120 |
Correct |
59 ms |
82004 KB |
Output is correct |
121 |
Correct |
38 ms |
77396 KB |
Output is correct |
122 |
Correct |
42 ms |
77404 KB |
Output is correct |
123 |
Correct |
41 ms |
77232 KB |
Output is correct |
124 |
Correct |
36 ms |
77276 KB |
Output is correct |
125 |
Correct |
37 ms |
77248 KB |
Output is correct |
126 |
Correct |
37 ms |
77384 KB |
Output is correct |
127 |
Correct |
37 ms |
77404 KB |
Output is correct |
128 |
Correct |
42 ms |
77532 KB |
Output is correct |
129 |
Correct |
37 ms |
77392 KB |
Output is correct |
130 |
Correct |
37 ms |
77404 KB |
Output is correct |
131 |
Correct |
46 ms |
77572 KB |
Output is correct |
132 |
Correct |
56 ms |
82260 KB |
Output is correct |
133 |
Correct |
57 ms |
82272 KB |
Output is correct |
134 |
Correct |
58 ms |
82428 KB |
Output is correct |
135 |
Correct |
37 ms |
77912 KB |
Output is correct |
136 |
Correct |
268 ms |
113236 KB |
Output is correct |
137 |
Correct |
158 ms |
97200 KB |
Output is correct |
138 |
Correct |
131 ms |
90960 KB |
Output is correct |
139 |
Correct |
147 ms |
92756 KB |
Output is correct |
140 |
Correct |
104 ms |
87100 KB |
Output is correct |
141 |
Correct |
46 ms |
79188 KB |
Output is correct |
142 |
Correct |
48 ms |
79196 KB |
Output is correct |
143 |
Correct |
52 ms |
79948 KB |
Output is correct |
144 |
Correct |
53 ms |
79256 KB |
Output is correct |
145 |
Correct |
49 ms |
79368 KB |
Output is correct |
146 |
Correct |
44 ms |
79180 KB |
Output is correct |
147 |
Correct |
52 ms |
80720 KB |
Output is correct |
148 |
Correct |
45 ms |
78172 KB |
Output is correct |
149 |
Correct |
54 ms |
80976 KB |
Output is correct |
150 |
Correct |
43 ms |
77908 KB |
Output is correct |
151 |
Correct |
60 ms |
82004 KB |
Output is correct |
152 |
Correct |
49 ms |
78676 KB |
Output is correct |
153 |
Correct |
41 ms |
78740 KB |
Output is correct |
154 |
Correct |
43 ms |
79184 KB |
Output is correct |
155 |
Correct |
40 ms |
78416 KB |
Output is correct |
156 |
Correct |
41 ms |
78428 KB |
Output is correct |
157 |
Correct |
38 ms |
77800 KB |
Output is correct |
158 |
Correct |
352 ms |
128588 KB |
Output is correct |
159 |
Correct |
288 ms |
114124 KB |
Output is correct |
160 |
Correct |
262 ms |
107720 KB |
Output is correct |
161 |
Correct |
214 ms |
102344 KB |
Output is correct |
162 |
Correct |
216 ms |
98384 KB |
Output is correct |
163 |
Correct |
57 ms |
80460 KB |
Output is correct |
164 |
Correct |
61 ms |
80460 KB |
Output is correct |
165 |
Correct |
56 ms |
80452 KB |
Output is correct |
166 |
Correct |
56 ms |
80400 KB |
Output is correct |
167 |
Correct |
54 ms |
80252 KB |
Output is correct |
168 |
Correct |
56 ms |
80212 KB |
Output is correct |
169 |
Correct |
65 ms |
83452 KB |
Output is correct |
170 |
Correct |
48 ms |
78940 KB |
Output is correct |
171 |
Correct |
70 ms |
83284 KB |
Output is correct |
172 |
Correct |
48 ms |
78932 KB |
Output is correct |
173 |
Correct |
77 ms |
83288 KB |
Output is correct |
174 |
Correct |
48 ms |
78924 KB |
Output is correct |
175 |
Correct |
46 ms |
79236 KB |
Output is correct |
176 |
Correct |
43 ms |
79184 KB |
Output is correct |
177 |
Correct |
43 ms |
79184 KB |
Output is correct |
178 |
Correct |
53 ms |
79116 KB |
Output is correct |
179 |
Correct |
43 ms |
79444 KB |
Output is correct |
180 |
Correct |
648 ms |
184344 KB |
Output is correct |
181 |
Correct |
784 ms |
199540 KB |
Output is correct |
182 |
Correct |
987 ms |
231012 KB |
Output is correct |
183 |
Correct |
509 ms |
146616 KB |
Output is correct |
184 |
Correct |
429 ms |
134184 KB |
Output is correct |
185 |
Correct |
68 ms |
83816 KB |
Output is correct |
186 |
Correct |
59 ms |
85068 KB |
Output is correct |
187 |
Correct |
68 ms |
85072 KB |
Output is correct |
188 |
Correct |
83 ms |
84980 KB |
Output is correct |
189 |
Correct |
81 ms |
84820 KB |
Output is correct |
190 |
Correct |
104 ms |
85620 KB |
Output is correct |
191 |
Correct |
77 ms |
85072 KB |
Output is correct |
192 |
Correct |
75 ms |
83224 KB |
Output is correct |
193 |
Correct |
86 ms |
83028 KB |
Output is correct |
194 |
Correct |
53 ms |
81200 KB |
Output is correct |
195 |
Execution timed out |
1586 ms |
340840 KB |
Time limit exceeded |
196 |
Halted |
0 ms |
0 KB |
- |