#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<int, pii> piii;
typedef pair<ll, ll> pll;
typedef pair<ll, pll> plll;
#define fi first
#define se second
const int INF = 1e9+1;
const int P = 1000000007;
const ll LLINF = (ll)1e18+1;
template <typename T1, typename T2>
ostream& operator<<(ostream& os, const pair<T1, T2>& p) { os << p.fi << " " << p.se; return os; }
template <typename T>
ostream& operator<<(ostream& os, const deque<T>& v) { for(auto i : v) os << i << " "; os << "\n"; return os; }
template <typename T>
ostream& operator<<(ostream& os, const vector<T>& v) { for(auto i : v) os << i << " "; os << "\n"; return os; }
vector<int> evaluate(int M, deque<int> &chk, vector<int> &can) {
vector<int> ret;
if(chk.size() > can.size()) return ret;
for(int i = 0; i < can.size(); i++) {
int diff = ((can[i]-chk[0])%M+M)%M;
bool valid = true;
for(int j = 0; j < chk.size(); j++) {
int tmp = ((chk[j]+diff)%M+M)%M;
auto iter = lower_bound(can.begin(), can.end(), tmp);
if(iter == can.end() || *iter != tmp) valid = false;
}
if(valid) ret.push_back(diff);
}
return ret;
}
template <typename node_seg, typename node_query = node_seg, typename index_t = int>
class Segtree {
private:
const size_t n;
std::vector<node_seg> seg;
void init(const size_t i, const index_t s, const index_t e, const std::vector<node_seg> &A) {
if(s+1 == e) seg[i] = A[s];
else {
init(i<<1, s, s+e>>1, A);
init(i<<1|1, s+e>>1, e, A);
seg[i] = seg[i<<1]+seg[i<<1|1];
}
}
void update(const size_t i, const index_t s, const index_t e, const index_t j, const node_query &x) {
if(j >= e || s > j) return;
if(s+1 == e) seg[i] += x;
else {
update(i<<1, s, s+e>>1, j, x);
update(i<<1|1, s+e>>1, e, j, x);
seg[i] = seg[i<<1]+seg[i<<1|1];
}
}
node_seg query(const size_t i, const index_t s, const index_t e, const index_t l, const index_t r) const {
if(e <= l || r <= s) return node_seg::inf();
if(l <= s && e <= r) return seg[i];
return query(i<<1, s, s+e>>1, l, r)+query(i<<1|1, s+e>>1, e, l, r);
}
public:
Segtree(const int n) : n(n) {
seg.resize(4*n, node_seg::inf());
}
Segtree(const std::vector<node_seg> &A) : n(A.size()) {
seg.resize(4*n, node_seg::inf());
init(1, 0, n, A);
}
void update(const index_t j, const node_query &x) { update(1, 0, n, j, x); }
node_seg query(const index_t l, const index_t r) const { return query(1, 0, n, l, r); }
};
struct min_node {
int x;
static min_node inf() { return {INF}; }
min_node operator+(const min_node &y) { return {min(x, y.x)}; }
void operator+=(const min_node &y) { x = min(x, y.x); }
};
void add(int M, int idx, int &uniqcnt, int &macnt,
vector<int> &verdict, vector<int> &cnt, deque<int> &chk, vector<int> &can) {
if(chk.empty()) uniqcnt++, macnt = 0;
else for(auto j : verdict) if(cnt[j]-- == uniqcnt) macnt--;
chk.push_back(idx);
verdict = evaluate(M, chk, can);
for(auto j : verdict) if(++cnt[j] == uniqcnt) macnt++;
}
void sub(int M, int &uniqcnt, int &macnt,
vector<int> &verdict, vector<int> &cnt, deque<int> &chk, vector<int> &can) {
for(auto j : verdict) if(cnt[j]-- == uniqcnt) macnt--;
chk.pop_front();
if(chk.empty()) uniqcnt--, verdict.clear();
else verdict = evaluate(M, chk, can);
for(auto j : verdict) if(++cnt[j] == uniqcnt) macnt++;
}
vector<bool> solve(int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) {
vector<deque<int>> chk(K);
vector<vector<int>> verdict(K), can(K);
vector<int> cnt(M, 0);
vector<bool> can_paint(N, false);
int macnt = 0, uniqcnt = 0;
for(int i = 0; i < M; i++) for(auto j : B[i]) can[j].push_back(i);
for(int i = 0; i < K; i++) {
if(chk[i].empty()) continue;
verdict[i] = evaluate(M, chk[i], can[i]);
for(auto j : verdict[i]) if(++cnt[j] == uniqcnt) macnt++;
}
for(int i = 0; i < M; i++) {
add(M, i, uniqcnt, macnt, verdict[C[i]], cnt, chk[C[i]], can[C[i]]);
//cout << "print : " << i << "\n " << verdict;
}
macnt = 0;
for(int i = 0; i < M; i++)
if(cnt[i] == uniqcnt) macnt++;
can_paint[M-1] = macnt > 0;
for(int i = M; i < N; i++) {
add(M, i, uniqcnt, macnt, verdict[C[i]], cnt, chk[C[i]], can[C[i]]);
sub(M, uniqcnt, macnt, verdict[C[i-M]], cnt, chk[C[i-M]], can[C[i-M]]);
macnt = 0;
for(int i = 0; i < M; i++)
if(cnt[i] == uniqcnt) macnt++;
can_paint[i] = macnt > 0;
//cout << "print : " << i << "\n " << verdict;
}
return can_paint;
}
int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) {
vector<bool> can_paint = solve(N, M, K, C, A, B);
//cout << can_paint;
Segtree<min_node> dp(vector<min_node>(N, min_node::inf()));
if(can_paint[M-1]) dp.update(M-1, {1});
for(int i = M; i < N; i++) {
if(can_paint[i]) {
int tmp = dp.query(i-M, i).x;
dp.update(i, {++tmp});
}
}
int ans = dp.query(N-1, N).x;
if(ans == INF) return -1;
else return ans;
}
Compilation message
paint.cpp: In function 'std::vector<int> evaluate(int, std::deque<int>&, std::vector<int>&)':
paint.cpp:24:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
24 | for(int i = 0; i < can.size(); i++) {
| ~~^~~~~~~~~~~~
paint.cpp:27:26: warning: comparison of integer expressions of different signedness: 'int' and 'std::deque<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
27 | for(int j = 0; j < chk.size(); j++) {
| ~~^~~~~~~~~~~~
paint.cpp: In instantiation of 'void Segtree<node_seg, node_query, index_t>::init(size_t, index_t, index_t, const std::vector<_Tp>&) [with node_seg = min_node; node_query = min_node; index_t = int; size_t = long unsigned int]':
paint.cpp:74:3: required from 'Segtree<node_seg, node_query, index_t>::Segtree(const std::vector<_Tp>&) [with node_seg = min_node; node_query = min_node; index_t = int]'
paint.cpp:140:62: required from here
paint.cpp:46:19: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
46 | init(i<<1, s, s+e>>1, A);
| ~^~
paint.cpp:47:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
47 | init(i<<1|1, s+e>>1, e, A);
| ~^~
paint.cpp: In instantiation of 'void Segtree<node_seg, node_query, index_t>::update(size_t, index_t, index_t, index_t, const node_query&) [with node_seg = min_node; node_query = min_node; index_t = int; size_t = long unsigned int]':
paint.cpp:76:60: required from 'void Segtree<node_seg, node_query, index_t>::update(index_t, const node_query&) [with node_seg = min_node; node_query = min_node; index_t = int]'
paint.cpp:141:42: required from here
paint.cpp:56:21: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
56 | update(i<<1, s, s+e>>1, j, x);
| ~^~
paint.cpp:57:20: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
57 | update(i<<1|1, s+e>>1, e, j, x);
| ~^~
paint.cpp: In instantiation of 'node_seg Segtree<node_seg, node_query, index_t>::query(size_t, index_t, index_t, index_t, index_t) const [with node_seg = min_node; node_query = min_node; index_t = int; size_t = long unsigned int]':
paint.cpp:77:71: required from 'node_seg Segtree<node_seg, node_query, index_t>::query(index_t, index_t) const [with node_seg = min_node; node_query = min_node; index_t = int]'
paint.cpp:144:38: required from here
paint.cpp:65:26: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
65 | return query(i<<1, s, s+e>>1, l, r)+query(i<<1|1, s+e>>1, e, l, r);
| ~^~
paint.cpp:65:54: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
65 | return query(i<<1, s, s+e>>1, l, r)+query(i<<1|1, s+e>>1, e, l, r);
| ~^~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
296 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 |
296 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
300 KB |
Output is correct |
13 |
Correct |
46 ms |
72364 KB |
Output is correct |
14 |
Correct |
54 ms |
72372 KB |
Output is correct |
15 |
Correct |
46 ms |
72268 KB |
Output is correct |
16 |
Correct |
46 ms |
72268 KB |
Output is correct |
17 |
Correct |
46 ms |
72332 KB |
Output is correct |
18 |
Correct |
51 ms |
72280 KB |
Output is correct |
19 |
Correct |
47 ms |
72316 KB |
Output is correct |
20 |
Correct |
55 ms |
72396 KB |
Output is correct |
21 |
Correct |
50 ms |
72432 KB |
Output is correct |
22 |
Correct |
69 ms |
77140 KB |
Output is correct |
23 |
Correct |
73 ms |
77208 KB |
Output is correct |
24 |
Correct |
75 ms |
77164 KB |
Output is correct |
25 |
Correct |
8 ms |
828 KB |
Output is correct |
26 |
Correct |
15 ms |
820 KB |
Output is correct |
27 |
Correct |
6 ms |
852 KB |
Output is correct |
28 |
Correct |
4 ms |
852 KB |
Output is correct |
29 |
Correct |
6 ms |
796 KB |
Output is correct |
30 |
Correct |
4 ms |
852 KB |
Output is correct |
31 |
Correct |
112 ms |
74420 KB |
Output is correct |
32 |
Correct |
86 ms |
74408 KB |
Output is correct |
33 |
Correct |
85 ms |
74492 KB |
Output is correct |
34 |
Correct |
88 ms |
74440 KB |
Output is correct |
35 |
Correct |
89 ms |
74376 KB |
Output is correct |
36 |
Correct |
92 ms |
74460 KB |
Output is correct |
37 |
Correct |
103 ms |
78264 KB |
Output is correct |
38 |
Correct |
95 ms |
78360 KB |
Output is correct |
39 |
Correct |
102 ms |
78324 KB |
Output is correct |
40 |
Correct |
32 ms |
3044 KB |
Output is correct |
41 |
Correct |
20 ms |
1908 KB |
Output is correct |
42 |
Correct |
27 ms |
3220 KB |
Output is correct |
43 |
Correct |
13 ms |
2132 KB |
Output is correct |
44 |
Correct |
12 ms |
2088 KB |
Output is correct |
45 |
Correct |
19 ms |
3232 KB |
Output is correct |
46 |
Correct |
1389 ms |
87824 KB |
Output is correct |
47 |
Correct |
644 ms |
74188 KB |
Output is correct |
48 |
Correct |
391 ms |
72432 KB |
Output is correct |
49 |
Correct |
667 ms |
73440 KB |
Output is correct |
50 |
Correct |
910 ms |
74980 KB |
Output is correct |
51 |
Correct |
788 ms |
60352 KB |
Output is correct |
52 |
Correct |
46 ms |
3140 KB |
Output is correct |
53 |
Correct |
38 ms |
3240 KB |
Output is correct |
54 |
Correct |
26 ms |
3192 KB |
Output is correct |
55 |
Correct |
20 ms |
3220 KB |
Output is correct |
56 |
Correct |
18 ms |
3192 KB |
Output is correct |
57 |
Correct |
18 ms |
3148 KB |
Output is correct |
58 |
Execution timed out |
1587 ms |
89768 KB |
Time limit exceeded |
59 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Correct |
1 ms |
296 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 |
296 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
300 KB |
Output is correct |
13 |
Correct |
46 ms |
72364 KB |
Output is correct |
14 |
Correct |
54 ms |
72372 KB |
Output is correct |
15 |
Correct |
46 ms |
72268 KB |
Output is correct |
16 |
Correct |
46 ms |
72268 KB |
Output is correct |
17 |
Correct |
46 ms |
72332 KB |
Output is correct |
18 |
Correct |
51 ms |
72280 KB |
Output is correct |
19 |
Correct |
47 ms |
72316 KB |
Output is correct |
20 |
Correct |
55 ms |
72396 KB |
Output is correct |
21 |
Correct |
50 ms |
72432 KB |
Output is correct |
22 |
Correct |
0 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 |
0 ms |
212 KB |
Output is correct |
26 |
Correct |
1 ms |
212 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
3 ms |
212 KB |
Output is correct |
29 |
Correct |
2 ms |
212 KB |
Output is correct |
30 |
Correct |
2 ms |
312 KB |
Output is correct |
31 |
Correct |
1 ms |
212 KB |
Output is correct |
32 |
Correct |
2 ms |
212 KB |
Output is correct |
33 |
Correct |
38 ms |
61856 KB |
Output is correct |
34 |
Correct |
28 ms |
46208 KB |
Output is correct |
35 |
Correct |
24 ms |
40632 KB |
Output is correct |
36 |
Correct |
42 ms |
70884 KB |
Output is correct |
37 |
Correct |
33 ms |
57412 KB |
Output is correct |
38 |
Correct |
43 ms |
63340 KB |
Output is correct |
39 |
Correct |
1 ms |
468 KB |
Output is correct |
40 |
Correct |
35 ms |
54596 KB |
Output is correct |
41 |
Correct |
1 ms |
468 KB |
Output is correct |
42 |
Correct |
43 ms |
68340 KB |
Output is correct |
43 |
Correct |
39 ms |
66584 KB |
Output is correct |
44 |
Correct |
0 ms |
212 KB |
Output is correct |
45 |
Correct |
6 ms |
212 KB |
Output is correct |
46 |
Correct |
5 ms |
316 KB |
Output is correct |
47 |
Correct |
4 ms |
212 KB |
Output is correct |
48 |
Correct |
3 ms |
212 KB |
Output is correct |
49 |
Correct |
3 ms |
212 KB |
Output is correct |
50 |
Correct |
47 ms |
72312 KB |
Output is correct |
51 |
Correct |
45 ms |
72392 KB |
Output is correct |
52 |
Correct |
47 ms |
72396 KB |
Output is correct |
53 |
Correct |
57 ms |
72276 KB |
Output is correct |
54 |
Correct |
57 ms |
72376 KB |
Output is correct |
55 |
Correct |
46 ms |
72268 KB |
Output is correct |
56 |
Correct |
45 ms |
72272 KB |
Output is correct |
57 |
Correct |
1 ms |
596 KB |
Output is correct |
58 |
Correct |
44 ms |
72320 KB |
Output is correct |
59 |
Correct |
1 ms |
596 KB |
Output is correct |
60 |
Correct |
44 ms |
72276 KB |
Output is correct |
61 |
Correct |
1 ms |
724 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
296 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 |
296 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
300 KB |
Output is correct |
15 |
Correct |
46 ms |
72364 KB |
Output is correct |
16 |
Correct |
54 ms |
72372 KB |
Output is correct |
17 |
Correct |
46 ms |
72268 KB |
Output is correct |
18 |
Correct |
46 ms |
72268 KB |
Output is correct |
19 |
Correct |
46 ms |
72332 KB |
Output is correct |
20 |
Correct |
51 ms |
72280 KB |
Output is correct |
21 |
Correct |
47 ms |
72316 KB |
Output is correct |
22 |
Correct |
55 ms |
72396 KB |
Output is correct |
23 |
Correct |
50 ms |
72432 KB |
Output is correct |
24 |
Correct |
69 ms |
77140 KB |
Output is correct |
25 |
Correct |
73 ms |
77208 KB |
Output is correct |
26 |
Correct |
75 ms |
77164 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
0 ms |
212 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
3 ms |
212 KB |
Output is correct |
32 |
Correct |
2 ms |
212 KB |
Output is correct |
33 |
Correct |
2 ms |
312 KB |
Output is correct |
34 |
Correct |
1 ms |
212 KB |
Output is correct |
35 |
Correct |
2 ms |
212 KB |
Output is correct |
36 |
Correct |
38 ms |
61856 KB |
Output is correct |
37 |
Correct |
28 ms |
46208 KB |
Output is correct |
38 |
Correct |
24 ms |
40632 KB |
Output is correct |
39 |
Correct |
42 ms |
70884 KB |
Output is correct |
40 |
Correct |
33 ms |
57412 KB |
Output is correct |
41 |
Correct |
43 ms |
63340 KB |
Output is correct |
42 |
Correct |
1 ms |
468 KB |
Output is correct |
43 |
Correct |
35 ms |
54596 KB |
Output is correct |
44 |
Correct |
1 ms |
468 KB |
Output is correct |
45 |
Correct |
43 ms |
68340 KB |
Output is correct |
46 |
Correct |
39 ms |
66584 KB |
Output is correct |
47 |
Correct |
0 ms |
212 KB |
Output is correct |
48 |
Correct |
6 ms |
212 KB |
Output is correct |
49 |
Correct |
5 ms |
316 KB |
Output is correct |
50 |
Correct |
4 ms |
212 KB |
Output is correct |
51 |
Correct |
3 ms |
212 KB |
Output is correct |
52 |
Correct |
3 ms |
212 KB |
Output is correct |
53 |
Correct |
47 ms |
72312 KB |
Output is correct |
54 |
Correct |
45 ms |
72392 KB |
Output is correct |
55 |
Correct |
47 ms |
72396 KB |
Output is correct |
56 |
Correct |
57 ms |
72276 KB |
Output is correct |
57 |
Correct |
57 ms |
72376 KB |
Output is correct |
58 |
Correct |
46 ms |
72268 KB |
Output is correct |
59 |
Correct |
45 ms |
72272 KB |
Output is correct |
60 |
Correct |
1 ms |
596 KB |
Output is correct |
61 |
Correct |
44 ms |
72320 KB |
Output is correct |
62 |
Correct |
1 ms |
596 KB |
Output is correct |
63 |
Correct |
44 ms |
72276 KB |
Output is correct |
64 |
Correct |
1 ms |
724 KB |
Output is correct |
65 |
Correct |
63 ms |
212 KB |
Output is correct |
66 |
Correct |
16 ms |
212 KB |
Output is correct |
67 |
Correct |
121 ms |
308 KB |
Output is correct |
68 |
Correct |
37 ms |
212 KB |
Output is correct |
69 |
Correct |
72 ms |
212 KB |
Output is correct |
70 |
Correct |
37 ms |
61540 KB |
Output is correct |
71 |
Correct |
33 ms |
50720 KB |
Output is correct |
72 |
Correct |
29 ms |
43988 KB |
Output is correct |
73 |
Correct |
32 ms |
50972 KB |
Output is correct |
74 |
Correct |
38 ms |
57908 KB |
Output is correct |
75 |
Correct |
45 ms |
71172 KB |
Output is correct |
76 |
Correct |
48 ms |
53640 KB |
Output is correct |
77 |
Correct |
53 ms |
66004 KB |
Output is correct |
78 |
Correct |
67 ms |
73668 KB |
Output is correct |
79 |
Correct |
179 ms |
340 KB |
Output is correct |
80 |
Correct |
388 ms |
340 KB |
Output is correct |
81 |
Correct |
294 ms |
340 KB |
Output is correct |
82 |
Correct |
246 ms |
340 KB |
Output is correct |
83 |
Correct |
196 ms |
340 KB |
Output is correct |
84 |
Correct |
44 ms |
72520 KB |
Output is correct |
85 |
Correct |
44 ms |
72640 KB |
Output is correct |
86 |
Correct |
44 ms |
72596 KB |
Output is correct |
87 |
Correct |
42 ms |
72632 KB |
Output is correct |
88 |
Correct |
54 ms |
72524 KB |
Output is correct |
89 |
Correct |
45 ms |
72532 KB |
Output is correct |
90 |
Correct |
72 ms |
76672 KB |
Output is correct |
91 |
Correct |
68 ms |
76584 KB |
Output is correct |
92 |
Correct |
65 ms |
76632 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
296 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 |
296 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
300 KB |
Output is correct |
15 |
Correct |
46 ms |
72364 KB |
Output is correct |
16 |
Correct |
54 ms |
72372 KB |
Output is correct |
17 |
Correct |
46 ms |
72268 KB |
Output is correct |
18 |
Correct |
46 ms |
72268 KB |
Output is correct |
19 |
Correct |
46 ms |
72332 KB |
Output is correct |
20 |
Correct |
51 ms |
72280 KB |
Output is correct |
21 |
Correct |
47 ms |
72316 KB |
Output is correct |
22 |
Correct |
55 ms |
72396 KB |
Output is correct |
23 |
Correct |
50 ms |
72432 KB |
Output is correct |
24 |
Correct |
69 ms |
77140 KB |
Output is correct |
25 |
Correct |
73 ms |
77208 KB |
Output is correct |
26 |
Correct |
75 ms |
77164 KB |
Output is correct |
27 |
Correct |
8 ms |
828 KB |
Output is correct |
28 |
Correct |
15 ms |
820 KB |
Output is correct |
29 |
Correct |
6 ms |
852 KB |
Output is correct |
30 |
Correct |
4 ms |
852 KB |
Output is correct |
31 |
Correct |
6 ms |
796 KB |
Output is correct |
32 |
Correct |
4 ms |
852 KB |
Output is correct |
33 |
Correct |
112 ms |
74420 KB |
Output is correct |
34 |
Correct |
86 ms |
74408 KB |
Output is correct |
35 |
Correct |
85 ms |
74492 KB |
Output is correct |
36 |
Correct |
88 ms |
74440 KB |
Output is correct |
37 |
Correct |
89 ms |
74376 KB |
Output is correct |
38 |
Correct |
92 ms |
74460 KB |
Output is correct |
39 |
Correct |
103 ms |
78264 KB |
Output is correct |
40 |
Correct |
95 ms |
78360 KB |
Output is correct |
41 |
Correct |
102 ms |
78324 KB |
Output is correct |
42 |
Correct |
0 ms |
212 KB |
Output is correct |
43 |
Correct |
0 ms |
212 KB |
Output is correct |
44 |
Correct |
1 ms |
212 KB |
Output is correct |
45 |
Correct |
1 ms |
212 KB |
Output is correct |
46 |
Correct |
3 ms |
212 KB |
Output is correct |
47 |
Correct |
2 ms |
212 KB |
Output is correct |
48 |
Correct |
2 ms |
312 KB |
Output is correct |
49 |
Correct |
1 ms |
212 KB |
Output is correct |
50 |
Correct |
2 ms |
212 KB |
Output is correct |
51 |
Correct |
38 ms |
61856 KB |
Output is correct |
52 |
Correct |
28 ms |
46208 KB |
Output is correct |
53 |
Correct |
24 ms |
40632 KB |
Output is correct |
54 |
Correct |
42 ms |
70884 KB |
Output is correct |
55 |
Correct |
33 ms |
57412 KB |
Output is correct |
56 |
Correct |
43 ms |
63340 KB |
Output is correct |
57 |
Correct |
1 ms |
468 KB |
Output is correct |
58 |
Correct |
35 ms |
54596 KB |
Output is correct |
59 |
Correct |
1 ms |
468 KB |
Output is correct |
60 |
Correct |
43 ms |
68340 KB |
Output is correct |
61 |
Correct |
39 ms |
66584 KB |
Output is correct |
62 |
Correct |
0 ms |
212 KB |
Output is correct |
63 |
Correct |
6 ms |
212 KB |
Output is correct |
64 |
Correct |
5 ms |
316 KB |
Output is correct |
65 |
Correct |
4 ms |
212 KB |
Output is correct |
66 |
Correct |
3 ms |
212 KB |
Output is correct |
67 |
Correct |
3 ms |
212 KB |
Output is correct |
68 |
Correct |
47 ms |
72312 KB |
Output is correct |
69 |
Correct |
45 ms |
72392 KB |
Output is correct |
70 |
Correct |
47 ms |
72396 KB |
Output is correct |
71 |
Correct |
57 ms |
72276 KB |
Output is correct |
72 |
Correct |
57 ms |
72376 KB |
Output is correct |
73 |
Correct |
46 ms |
72268 KB |
Output is correct |
74 |
Correct |
45 ms |
72272 KB |
Output is correct |
75 |
Correct |
1 ms |
596 KB |
Output is correct |
76 |
Correct |
44 ms |
72320 KB |
Output is correct |
77 |
Correct |
1 ms |
596 KB |
Output is correct |
78 |
Correct |
44 ms |
72276 KB |
Output is correct |
79 |
Correct |
1 ms |
724 KB |
Output is correct |
80 |
Correct |
63 ms |
212 KB |
Output is correct |
81 |
Correct |
16 ms |
212 KB |
Output is correct |
82 |
Correct |
121 ms |
308 KB |
Output is correct |
83 |
Correct |
37 ms |
212 KB |
Output is correct |
84 |
Correct |
72 ms |
212 KB |
Output is correct |
85 |
Correct |
37 ms |
61540 KB |
Output is correct |
86 |
Correct |
33 ms |
50720 KB |
Output is correct |
87 |
Correct |
29 ms |
43988 KB |
Output is correct |
88 |
Correct |
32 ms |
50972 KB |
Output is correct |
89 |
Correct |
38 ms |
57908 KB |
Output is correct |
90 |
Correct |
45 ms |
71172 KB |
Output is correct |
91 |
Correct |
48 ms |
53640 KB |
Output is correct |
92 |
Correct |
53 ms |
66004 KB |
Output is correct |
93 |
Correct |
67 ms |
73668 KB |
Output is correct |
94 |
Correct |
179 ms |
340 KB |
Output is correct |
95 |
Correct |
388 ms |
340 KB |
Output is correct |
96 |
Correct |
294 ms |
340 KB |
Output is correct |
97 |
Correct |
246 ms |
340 KB |
Output is correct |
98 |
Correct |
196 ms |
340 KB |
Output is correct |
99 |
Correct |
44 ms |
72520 KB |
Output is correct |
100 |
Correct |
44 ms |
72640 KB |
Output is correct |
101 |
Correct |
44 ms |
72596 KB |
Output is correct |
102 |
Correct |
42 ms |
72632 KB |
Output is correct |
103 |
Correct |
54 ms |
72524 KB |
Output is correct |
104 |
Correct |
45 ms |
72532 KB |
Output is correct |
105 |
Correct |
72 ms |
76672 KB |
Output is correct |
106 |
Correct |
68 ms |
76584 KB |
Output is correct |
107 |
Correct |
65 ms |
76632 KB |
Output is correct |
108 |
Correct |
8 ms |
852 KB |
Output is correct |
109 |
Execution timed out |
1563 ms |
612 KB |
Time limit exceeded |
110 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
296 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 |
296 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
300 KB |
Output is correct |
15 |
Correct |
46 ms |
72364 KB |
Output is correct |
16 |
Correct |
54 ms |
72372 KB |
Output is correct |
17 |
Correct |
46 ms |
72268 KB |
Output is correct |
18 |
Correct |
46 ms |
72268 KB |
Output is correct |
19 |
Correct |
46 ms |
72332 KB |
Output is correct |
20 |
Correct |
51 ms |
72280 KB |
Output is correct |
21 |
Correct |
47 ms |
72316 KB |
Output is correct |
22 |
Correct |
55 ms |
72396 KB |
Output is correct |
23 |
Correct |
50 ms |
72432 KB |
Output is correct |
24 |
Correct |
69 ms |
77140 KB |
Output is correct |
25 |
Correct |
73 ms |
77208 KB |
Output is correct |
26 |
Correct |
75 ms |
77164 KB |
Output is correct |
27 |
Correct |
8 ms |
828 KB |
Output is correct |
28 |
Correct |
15 ms |
820 KB |
Output is correct |
29 |
Correct |
6 ms |
852 KB |
Output is correct |
30 |
Correct |
4 ms |
852 KB |
Output is correct |
31 |
Correct |
6 ms |
796 KB |
Output is correct |
32 |
Correct |
4 ms |
852 KB |
Output is correct |
33 |
Correct |
112 ms |
74420 KB |
Output is correct |
34 |
Correct |
86 ms |
74408 KB |
Output is correct |
35 |
Correct |
85 ms |
74492 KB |
Output is correct |
36 |
Correct |
88 ms |
74440 KB |
Output is correct |
37 |
Correct |
89 ms |
74376 KB |
Output is correct |
38 |
Correct |
92 ms |
74460 KB |
Output is correct |
39 |
Correct |
103 ms |
78264 KB |
Output is correct |
40 |
Correct |
95 ms |
78360 KB |
Output is correct |
41 |
Correct |
102 ms |
78324 KB |
Output is correct |
42 |
Correct |
32 ms |
3044 KB |
Output is correct |
43 |
Correct |
20 ms |
1908 KB |
Output is correct |
44 |
Correct |
27 ms |
3220 KB |
Output is correct |
45 |
Correct |
13 ms |
2132 KB |
Output is correct |
46 |
Correct |
12 ms |
2088 KB |
Output is correct |
47 |
Correct |
19 ms |
3232 KB |
Output is correct |
48 |
Correct |
1389 ms |
87824 KB |
Output is correct |
49 |
Correct |
644 ms |
74188 KB |
Output is correct |
50 |
Correct |
391 ms |
72432 KB |
Output is correct |
51 |
Correct |
667 ms |
73440 KB |
Output is correct |
52 |
Correct |
910 ms |
74980 KB |
Output is correct |
53 |
Correct |
788 ms |
60352 KB |
Output is correct |
54 |
Correct |
46 ms |
3140 KB |
Output is correct |
55 |
Correct |
38 ms |
3240 KB |
Output is correct |
56 |
Correct |
26 ms |
3192 KB |
Output is correct |
57 |
Correct |
20 ms |
3220 KB |
Output is correct |
58 |
Correct |
18 ms |
3192 KB |
Output is correct |
59 |
Correct |
18 ms |
3148 KB |
Output is correct |
60 |
Execution timed out |
1587 ms |
89768 KB |
Time limit exceeded |
61 |
Halted |
0 ms |
0 KB |
- |