답안 #387312

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
387312 2021-04-08T08:59:41 Z milleniumEeee 벽 칠하기 (APIO20_paint) C++17
63 / 100
1500 ms 161100 KB
#include <bits/stdc++.h>
#include "paint.h"
//#include "grader.cpp"
#define all(s) s.begin(), s.end()
#define chkmin(a, b) a = min(a, b)
#define chkmax(a, b) a = max(a, b)
using namespace std;
 
const int MAXN = (int)1e5 + 5;
const int INF = 1e9 + 7;
 
int pos[MAXN];
int dp[MAXN];
int pref[MAXN];
 
struct Segment_Tree {
	vector <int> tree;
	vector <int> lazy;
	Segment_Tree (int n) {
		tree.resize(n * 4, INF);
		lazy.resize(n * 4, INF);
	}
	void push(int v, int tl, int tr) {
		if (lazy[v] == INF) {
			return;
		}
		if (tl != tr) {
			chkmin(lazy[v + v], lazy[v]);
			chkmin(lazy[v + v + 1], lazy[v]);
		}
		chkmin(tree[v], lazy[v]);
		lazy[v] = INF;
	}
	void upd(int l, int r, int val, int v, int tl, int tr) {
		push(v, tl, tr);
		if (l > tr || tl > r) {
			return;
		}
		if (l <= tl && tr <= r) {
			lazy[v] = val;
			push(v, tl, tr);
			return;
		}
		int mid = (tl + tr) >> 1;
		upd(l, r, val, v + v, tl, mid);
		upd(l, r, val, v + v + 1, mid + 1, tr);
		tree[v] = min(tree[v + v], tree[v + v + 1]);
	}
	int get(int l, int r, int v, int tl, int tr) {
		push(v, tl, tr);
		if (l > tr || tl > r) {
			return INF;
		}
		if (l <= tl && tr <= r) {
			return tree[v];
		}
		int mid = (tl + tr) >> 1;
		return min(get(l, r, v + v, tl, mid), get(l, r, v + v + 1, mid + 1, tr));
	}
};
 
int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) {
	memset(pos, -1, sizeof(pos));
	bool subtask1 = true;
	for (int i = 0; i < M; i++) {
		for (int el : B[i]) {
			if (pos[el] != -1) {
				subtask1 = false;
			}
			pos[el] = i;
		}
	}
	for (int i = 0; i < N; i++) {
		if (pos[C[i]] == -1) {
			return -1;
		}
	}
	auto nxt = [&](int p) {
		if (p + 1 < M) {
			return p + 1;
		} else {
			return 0;
		}
	};
	for (int i = 0; i + 1 < N; i++) {
		int before = (i > 0 ? pref[i - 1] : 0);
		pref[i] = before + (pos[C[i + 1]] == nxt(pos[C[i]]));
	}
	auto get = [&](int l, int r) {
		return pref[r - 1] - pref[l - 1];
	};
	
	
	bool subtask3 = (N <= 20000 && M <= min(N, 2000));
	//subtask3 = false; // wtf
	vector <vector<int>> Q;
	vector <int> MAXQ;
	if (subtask3) {
		Q.resize(N + 1);
		MAXQ.resize(N + 1);
		for (auto &el : Q) {
			el.resize(M, 0);
		}
		auto exist = [&](vector <int> &vec, int color) {
			return binary_search(all(vec), color);
		};
		
		for (int i = N - 1; i >= 0; i--) {
			MAXQ[i] = 0;
			for (int j = 0; j < M; j++) {
				if (exist(B[j], C[i])) {
					int add = 0;
					if (i + 1 < N) {
						add = Q[i + 1][(j + 1) % M];
					}
					Q[i][j] = 1 + add;
				} else {
					Q[i][j] = 0;
				}
				MAXQ[i] = max(MAXQ[i], Q[i][j]);
			}
		}
	}
	auto can = [&](int l, int r) {
		if (subtask3) {
			return l + MAXQ[l] - 1 >= r;
		}
		if (subtask1) {
			if (r - l + 1 == M && get(l, r) == M - 1) {
				return true;
			} else {
				return false;
			}			
		} else {
			for (int x = 0; x < M; x++) {
				bool ok = 1;
				int step = 0;
				int pos = x;
				while (1) {
					ok &= (binary_search(all(B[pos]), C[l + step]));
					step++;
					pos = nxt(pos);
					if (step == M) {
						break;
					}
				}
				if (ok) {
					return true;
				}
			}
			return false;
		}
	};
	fill(dp, dp + MAXN, INF);
	Segment_Tree T(N);
	if (can(0, M - 1)) {
		T.upd(0, M - 1, 1, 1, 0, N - 1);
	}
	for (int i = M; i < N; i++) {
		if (can(i - M + 1, i)) {
			int best = T.get(i - M, i - 1, 1, 0, N - 1);
			T.upd(i - M + 1, i, best + 1, 1, 0, N - 1);
		}
	}
	if (T.get(N - 1, N - 1, 1, 0, N - 1) < INF) {
		return T.get(N - 1, N - 1, 1, 0, N - 1);
	} else {
		return -1;
	}
}
 
/*
5 3 10
0 2 1 4 3
2 0 4
2 3 2
1 1
*/

Compilation message

paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:90:34: warning: array subscript -1 is below array bounds of 'int [100005]' [-Warray-bounds]
   90 |   return pref[r - 1] - pref[l - 1];
      |                        ~~~~~~~~~~^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1132 KB Output is correct
2 Correct 2 ms 1132 KB Output is correct
3 Correct 1 ms 748 KB Output is correct
4 Correct 2 ms 1132 KB Output is correct
5 Correct 1 ms 1132 KB Output is correct
6 Correct 2 ms 1132 KB Output is correct
7 Correct 2 ms 1132 KB Output is correct
8 Correct 2 ms 1132 KB Output is correct
9 Correct 2 ms 1132 KB Output is correct
10 Correct 2 ms 1132 KB Output is correct
11 Correct 2 ms 1132 KB Output is correct
12 Correct 2 ms 1132 KB Output is correct
13 Correct 3 ms 1536 KB Output is correct
14 Correct 4 ms 1516 KB Output is correct
15 Correct 3 ms 1516 KB Output is correct
16 Correct 4 ms 1516 KB Output is correct
17 Correct 4 ms 1516 KB Output is correct
18 Correct 3 ms 1516 KB Output is correct
19 Correct 2 ms 772 KB Output is correct
20 Correct 2 ms 748 KB Output is correct
21 Correct 2 ms 748 KB Output is correct
22 Correct 22 ms 2796 KB Output is correct
23 Correct 20 ms 2796 KB Output is correct
24 Correct 19 ms 2796 KB Output is correct
25 Correct 14 ms 3180 KB Output is correct
26 Correct 14 ms 3180 KB Output is correct
27 Correct 13 ms 3180 KB Output is correct
28 Correct 8 ms 3180 KB Output is correct
29 Correct 7 ms 3180 KB Output is correct
30 Correct 7 ms 3180 KB Output is correct
31 Correct 863 ms 159852 KB Output is correct
32 Correct 869 ms 159940 KB Output is correct
33 Correct 865 ms 159984 KB Output is correct
34 Correct 868 ms 159852 KB Output is correct
35 Correct 865 ms 159988 KB Output is correct
36 Correct 880 ms 160108 KB Output is correct
37 Correct 1301 ms 161100 KB Output is correct
38 Correct 1369 ms 160968 KB Output is correct
39 Correct 1354 ms 161096 KB Output is correct
40 Correct 55 ms 5228 KB Output is correct
41 Correct 34 ms 3820 KB Output is correct
42 Correct 40 ms 5484 KB Output is correct
43 Correct 20 ms 4224 KB Output is correct
44 Correct 10 ms 3820 KB Output is correct
45 Correct 15 ms 5612 KB Output is correct
46 Correct 76 ms 11628 KB Output is correct
47 Correct 51 ms 7108 KB Output is correct
48 Correct 39 ms 9580 KB Output is correct
49 Correct 34 ms 9196 KB Output is correct
50 Correct 35 ms 9068 KB Output is correct
51 Correct 30 ms 7404 KB Output is correct
52 Correct 61 ms 5612 KB Output is correct
53 Correct 61 ms 5612 KB Output is correct
54 Correct 41 ms 5612 KB Output is correct
55 Correct 21 ms 5612 KB Output is correct
56 Correct 16 ms 5612 KB Output is correct
57 Correct 15 ms 5612 KB Output is correct
58 Correct 105 ms 12648 KB Output is correct
59 Correct 104 ms 12524 KB Output is correct
60 Correct 92 ms 12652 KB Output is correct
61 Correct 102 ms 12524 KB Output is correct
62 Correct 92 ms 12524 KB Output is correct
63 Correct 92 ms 12524 KB Output is correct
64 Correct 44 ms 11756 KB Output is correct
65 Correct 43 ms 11756 KB Output is correct
66 Correct 52 ms 11756 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1132 KB Output is correct
2 Correct 2 ms 1132 KB Output is correct
3 Correct 1 ms 748 KB Output is correct
4 Correct 2 ms 1132 KB Output is correct
5 Correct 1 ms 1132 KB Output is correct
6 Correct 2 ms 1132 KB Output is correct
7 Correct 2 ms 1132 KB Output is correct
8 Correct 2 ms 1132 KB Output is correct
9 Correct 2 ms 1132 KB Output is correct
10 Correct 2 ms 1132 KB Output is correct
11 Correct 2 ms 1132 KB Output is correct
12 Correct 2 ms 1132 KB Output is correct
13 Correct 3 ms 1536 KB Output is correct
14 Correct 4 ms 1516 KB Output is correct
15 Correct 3 ms 1516 KB Output is correct
16 Correct 4 ms 1516 KB Output is correct
17 Correct 4 ms 1516 KB Output is correct
18 Correct 3 ms 1516 KB Output is correct
19 Correct 2 ms 772 KB Output is correct
20 Correct 2 ms 748 KB Output is correct
21 Correct 2 ms 748 KB Output is correct
22 Correct 3 ms 1132 KB Output is correct
23 Correct 2 ms 1132 KB Output is correct
24 Correct 2 ms 1132 KB Output is correct
25 Correct 2 ms 748 KB Output is correct
26 Correct 2 ms 1132 KB Output is correct
27 Correct 2 ms 1148 KB Output is correct
28 Correct 2 ms 1132 KB Output is correct
29 Correct 2 ms 1132 KB Output is correct
30 Correct 2 ms 1132 KB Output is correct
31 Correct 2 ms 1132 KB Output is correct
32 Correct 2 ms 1260 KB Output is correct
33 Correct 5 ms 1388 KB Output is correct
34 Correct 5 ms 1388 KB Output is correct
35 Correct 2 ms 1260 KB Output is correct
36 Correct 3 ms 1388 KB Output is correct
37 Correct 3 ms 1388 KB Output is correct
38 Correct 1 ms 748 KB Output is correct
39 Correct 3 ms 1132 KB Output is correct
40 Correct 1 ms 748 KB Output is correct
41 Correct 3 ms 1388 KB Output is correct
42 Correct 1 ms 748 KB Output is correct
43 Correct 2 ms 1260 KB Output is correct
44 Correct 1 ms 1132 KB Output is correct
45 Correct 3 ms 1276 KB Output is correct
46 Correct 4 ms 1260 KB Output is correct
47 Correct 2 ms 1260 KB Output is correct
48 Correct 2 ms 1260 KB Output is correct
49 Correct 2 ms 1260 KB Output is correct
50 Correct 3 ms 1516 KB Output is correct
51 Correct 3 ms 1516 KB Output is correct
52 Correct 3 ms 1516 KB Output is correct
53 Correct 4 ms 1516 KB Output is correct
54 Correct 4 ms 1516 KB Output is correct
55 Correct 5 ms 1516 KB Output is correct
56 Correct 2 ms 748 KB Output is correct
57 Correct 3 ms 1516 KB Output is correct
58 Correct 2 ms 748 KB Output is correct
59 Correct 5 ms 1516 KB Output is correct
60 Correct 2 ms 876 KB Output is correct
61 Correct 3 ms 1516 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1132 KB Output is correct
2 Correct 2 ms 1132 KB Output is correct
3 Correct 2 ms 1132 KB Output is correct
4 Correct 2 ms 1132 KB Output is correct
5 Correct 1 ms 748 KB Output is correct
6 Correct 2 ms 1132 KB Output is correct
7 Correct 1 ms 1132 KB Output is correct
8 Correct 2 ms 1132 KB Output is correct
9 Correct 2 ms 1132 KB Output is correct
10 Correct 2 ms 1132 KB Output is correct
11 Correct 2 ms 1132 KB Output is correct
12 Correct 2 ms 1132 KB Output is correct
13 Correct 2 ms 1132 KB Output is correct
14 Correct 2 ms 1132 KB Output is correct
15 Correct 3 ms 1536 KB Output is correct
16 Correct 4 ms 1516 KB Output is correct
17 Correct 3 ms 1516 KB Output is correct
18 Correct 4 ms 1516 KB Output is correct
19 Correct 4 ms 1516 KB Output is correct
20 Correct 3 ms 1516 KB Output is correct
21 Correct 2 ms 772 KB Output is correct
22 Correct 2 ms 748 KB Output is correct
23 Correct 2 ms 748 KB Output is correct
24 Correct 22 ms 2796 KB Output is correct
25 Correct 20 ms 2796 KB Output is correct
26 Correct 19 ms 2796 KB Output is correct
27 Correct 2 ms 1132 KB Output is correct
28 Correct 2 ms 748 KB Output is correct
29 Correct 2 ms 1132 KB Output is correct
30 Correct 2 ms 1148 KB Output is correct
31 Correct 2 ms 1132 KB Output is correct
32 Correct 2 ms 1132 KB Output is correct
33 Correct 2 ms 1132 KB Output is correct
34 Correct 2 ms 1132 KB Output is correct
35 Correct 2 ms 1260 KB Output is correct
36 Correct 5 ms 1388 KB Output is correct
37 Correct 5 ms 1388 KB Output is correct
38 Correct 2 ms 1260 KB Output is correct
39 Correct 3 ms 1388 KB Output is correct
40 Correct 3 ms 1388 KB Output is correct
41 Correct 1 ms 748 KB Output is correct
42 Correct 3 ms 1132 KB Output is correct
43 Correct 1 ms 748 KB Output is correct
44 Correct 3 ms 1388 KB Output is correct
45 Correct 1 ms 748 KB Output is correct
46 Correct 2 ms 1260 KB Output is correct
47 Correct 1 ms 1132 KB Output is correct
48 Correct 3 ms 1276 KB Output is correct
49 Correct 4 ms 1260 KB Output is correct
50 Correct 2 ms 1260 KB Output is correct
51 Correct 2 ms 1260 KB Output is correct
52 Correct 2 ms 1260 KB Output is correct
53 Correct 3 ms 1516 KB Output is correct
54 Correct 3 ms 1516 KB Output is correct
55 Correct 3 ms 1516 KB Output is correct
56 Correct 4 ms 1516 KB Output is correct
57 Correct 4 ms 1516 KB Output is correct
58 Correct 5 ms 1516 KB Output is correct
59 Correct 2 ms 748 KB Output is correct
60 Correct 3 ms 1516 KB Output is correct
61 Correct 2 ms 748 KB Output is correct
62 Correct 5 ms 1516 KB Output is correct
63 Correct 2 ms 876 KB Output is correct
64 Correct 3 ms 1516 KB Output is correct
65 Correct 2 ms 1260 KB Output is correct
66 Correct 2 ms 1260 KB Output is correct
67 Correct 3 ms 1388 KB Output is correct
68 Correct 2 ms 1260 KB Output is correct
69 Correct 3 ms 1388 KB Output is correct
70 Correct 6 ms 1644 KB Output is correct
71 Correct 6 ms 1516 KB Output is correct
72 Correct 5 ms 1388 KB Output is correct
73 Correct 3 ms 1260 KB Output is correct
74 Correct 5 ms 1388 KB Output is correct
75 Correct 5 ms 1516 KB Output is correct
76 Correct 15 ms 2284 KB Output is correct
77 Correct 18 ms 2412 KB Output is correct
78 Correct 19 ms 2668 KB Output is correct
79 Correct 3 ms 1516 KB Output is correct
80 Correct 4 ms 1516 KB Output is correct
81 Correct 3 ms 1516 KB Output is correct
82 Correct 3 ms 1516 KB Output is correct
83 Correct 3 ms 1516 KB Output is correct
84 Correct 7 ms 1772 KB Output is correct
85 Correct 7 ms 1772 KB Output is correct
86 Correct 7 ms 1772 KB Output is correct
87 Correct 7 ms 1772 KB Output is correct
88 Correct 7 ms 1772 KB Output is correct
89 Correct 7 ms 1772 KB Output is correct
90 Correct 22 ms 2828 KB Output is correct
91 Correct 22 ms 2796 KB Output is correct
92 Correct 23 ms 2796 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1132 KB Output is correct
2 Correct 2 ms 1132 KB Output is correct
3 Correct 2 ms 1132 KB Output is correct
4 Correct 2 ms 1132 KB Output is correct
5 Correct 1 ms 748 KB Output is correct
6 Correct 2 ms 1132 KB Output is correct
7 Correct 1 ms 1132 KB Output is correct
8 Correct 2 ms 1132 KB Output is correct
9 Correct 2 ms 1132 KB Output is correct
10 Correct 2 ms 1132 KB Output is correct
11 Correct 2 ms 1132 KB Output is correct
12 Correct 2 ms 1132 KB Output is correct
13 Correct 2 ms 1132 KB Output is correct
14 Correct 2 ms 1132 KB Output is correct
15 Correct 3 ms 1536 KB Output is correct
16 Correct 4 ms 1516 KB Output is correct
17 Correct 3 ms 1516 KB Output is correct
18 Correct 4 ms 1516 KB Output is correct
19 Correct 4 ms 1516 KB Output is correct
20 Correct 3 ms 1516 KB Output is correct
21 Correct 2 ms 772 KB Output is correct
22 Correct 2 ms 748 KB Output is correct
23 Correct 2 ms 748 KB Output is correct
24 Correct 22 ms 2796 KB Output is correct
25 Correct 20 ms 2796 KB Output is correct
26 Correct 19 ms 2796 KB Output is correct
27 Correct 14 ms 3180 KB Output is correct
28 Correct 14 ms 3180 KB Output is correct
29 Correct 13 ms 3180 KB Output is correct
30 Correct 8 ms 3180 KB Output is correct
31 Correct 7 ms 3180 KB Output is correct
32 Correct 7 ms 3180 KB Output is correct
33 Correct 863 ms 159852 KB Output is correct
34 Correct 869 ms 159940 KB Output is correct
35 Correct 865 ms 159984 KB Output is correct
36 Correct 868 ms 159852 KB Output is correct
37 Correct 865 ms 159988 KB Output is correct
38 Correct 880 ms 160108 KB Output is correct
39 Correct 1301 ms 161100 KB Output is correct
40 Correct 1369 ms 160968 KB Output is correct
41 Correct 1354 ms 161096 KB Output is correct
42 Correct 2 ms 1132 KB Output is correct
43 Correct 2 ms 748 KB Output is correct
44 Correct 2 ms 1132 KB Output is correct
45 Correct 2 ms 1148 KB Output is correct
46 Correct 2 ms 1132 KB Output is correct
47 Correct 2 ms 1132 KB Output is correct
48 Correct 2 ms 1132 KB Output is correct
49 Correct 2 ms 1132 KB Output is correct
50 Correct 2 ms 1260 KB Output is correct
51 Correct 5 ms 1388 KB Output is correct
52 Correct 5 ms 1388 KB Output is correct
53 Correct 2 ms 1260 KB Output is correct
54 Correct 3 ms 1388 KB Output is correct
55 Correct 3 ms 1388 KB Output is correct
56 Correct 1 ms 748 KB Output is correct
57 Correct 3 ms 1132 KB Output is correct
58 Correct 1 ms 748 KB Output is correct
59 Correct 3 ms 1388 KB Output is correct
60 Correct 1 ms 748 KB Output is correct
61 Correct 2 ms 1260 KB Output is correct
62 Correct 1 ms 1132 KB Output is correct
63 Correct 3 ms 1276 KB Output is correct
64 Correct 4 ms 1260 KB Output is correct
65 Correct 2 ms 1260 KB Output is correct
66 Correct 2 ms 1260 KB Output is correct
67 Correct 2 ms 1260 KB Output is correct
68 Correct 3 ms 1516 KB Output is correct
69 Correct 3 ms 1516 KB Output is correct
70 Correct 3 ms 1516 KB Output is correct
71 Correct 4 ms 1516 KB Output is correct
72 Correct 4 ms 1516 KB Output is correct
73 Correct 5 ms 1516 KB Output is correct
74 Correct 2 ms 748 KB Output is correct
75 Correct 3 ms 1516 KB Output is correct
76 Correct 2 ms 748 KB Output is correct
77 Correct 5 ms 1516 KB Output is correct
78 Correct 2 ms 876 KB Output is correct
79 Correct 3 ms 1516 KB Output is correct
80 Correct 2 ms 1260 KB Output is correct
81 Correct 2 ms 1260 KB Output is correct
82 Correct 3 ms 1388 KB Output is correct
83 Correct 2 ms 1260 KB Output is correct
84 Correct 3 ms 1388 KB Output is correct
85 Correct 6 ms 1644 KB Output is correct
86 Correct 6 ms 1516 KB Output is correct
87 Correct 5 ms 1388 KB Output is correct
88 Correct 3 ms 1260 KB Output is correct
89 Correct 5 ms 1388 KB Output is correct
90 Correct 5 ms 1516 KB Output is correct
91 Correct 15 ms 2284 KB Output is correct
92 Correct 18 ms 2412 KB Output is correct
93 Correct 19 ms 2668 KB Output is correct
94 Correct 3 ms 1516 KB Output is correct
95 Correct 4 ms 1516 KB Output is correct
96 Correct 3 ms 1516 KB Output is correct
97 Correct 3 ms 1516 KB Output is correct
98 Correct 3 ms 1516 KB Output is correct
99 Correct 7 ms 1772 KB Output is correct
100 Correct 7 ms 1772 KB Output is correct
101 Correct 7 ms 1772 KB Output is correct
102 Correct 7 ms 1772 KB Output is correct
103 Correct 7 ms 1772 KB Output is correct
104 Correct 7 ms 1772 KB Output is correct
105 Correct 22 ms 2828 KB Output is correct
106 Correct 22 ms 2796 KB Output is correct
107 Correct 23 ms 2796 KB Output is correct
108 Correct 14 ms 3180 KB Output is correct
109 Correct 100 ms 37408 KB Output is correct
110 Correct 111 ms 33252 KB Output is correct
111 Correct 109 ms 32748 KB Output is correct
112 Correct 161 ms 46444 KB Output is correct
113 Correct 154 ms 42144 KB Output is correct
114 Correct 370 ms 46116 KB Output is correct
115 Correct 61 ms 5484 KB Output is correct
116 Correct 543 ms 55604 KB Output is correct
117 Correct 295 ms 32236 KB Output is correct
118 Correct 90 ms 7660 KB Output is correct
119 Correct 606 ms 87152 KB Output is correct
120 Correct 15 ms 2284 KB Output is correct
121 Correct 444 ms 93292 KB Output is correct
122 Correct 18 ms 2540 KB Output is correct
123 Correct 174 ms 27580 KB Output is correct
124 Correct 20 ms 2668 KB Output is correct
125 Correct 140 ms 14444 KB Output is correct
126 Correct 30 ms 3820 KB Output is correct
127 Correct 333 ms 41836 KB Output is correct
128 Correct 98 ms 9580 KB Output is correct
129 Correct 123 ms 13320 KB Output is correct
130 Correct 15 ms 3180 KB Output is correct
131 Correct 144 ms 52460 KB Output is correct
132 Correct 222 ms 65652 KB Output is correct
133 Correct 264 ms 73804 KB Output is correct
134 Correct 285 ms 80364 KB Output is correct
135 Correct 308 ms 86180 KB Output is correct
136 Correct 1183 ms 160704 KB Output is correct
137 Correct 1290 ms 160832 KB Output is correct
138 Correct 1231 ms 160876 KB Output is correct
139 Correct 1199 ms 160908 KB Output is correct
140 Correct 1210 ms 160832 KB Output is correct
141 Correct 1186 ms 160832 KB Output is correct
142 Correct 24 ms 3308 KB Output is correct
143 Correct 858 ms 159980 KB Output is correct
144 Correct 25 ms 3308 KB Output is correct
145 Correct 863 ms 159968 KB Output is correct
146 Correct 28 ms 3308 KB Output is correct
147 Correct 858 ms 159968 KB Output is correct
148 Correct 935 ms 160148 KB Output is correct
149 Correct 563 ms 81900 KB Output is correct
150 Correct 413 ms 55404 KB Output is correct
151 Correct 389 ms 42604 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 1132 KB Output is correct
2 Correct 2 ms 1132 KB Output is correct
3 Correct 2 ms 1132 KB Output is correct
4 Correct 2 ms 1132 KB Output is correct
5 Correct 1 ms 748 KB Output is correct
6 Correct 2 ms 1132 KB Output is correct
7 Correct 1 ms 1132 KB Output is correct
8 Correct 2 ms 1132 KB Output is correct
9 Correct 2 ms 1132 KB Output is correct
10 Correct 2 ms 1132 KB Output is correct
11 Correct 2 ms 1132 KB Output is correct
12 Correct 2 ms 1132 KB Output is correct
13 Correct 2 ms 1132 KB Output is correct
14 Correct 2 ms 1132 KB Output is correct
15 Correct 3 ms 1536 KB Output is correct
16 Correct 4 ms 1516 KB Output is correct
17 Correct 3 ms 1516 KB Output is correct
18 Correct 4 ms 1516 KB Output is correct
19 Correct 4 ms 1516 KB Output is correct
20 Correct 3 ms 1516 KB Output is correct
21 Correct 2 ms 772 KB Output is correct
22 Correct 2 ms 748 KB Output is correct
23 Correct 2 ms 748 KB Output is correct
24 Correct 22 ms 2796 KB Output is correct
25 Correct 20 ms 2796 KB Output is correct
26 Correct 19 ms 2796 KB Output is correct
27 Correct 14 ms 3180 KB Output is correct
28 Correct 14 ms 3180 KB Output is correct
29 Correct 13 ms 3180 KB Output is correct
30 Correct 8 ms 3180 KB Output is correct
31 Correct 7 ms 3180 KB Output is correct
32 Correct 7 ms 3180 KB Output is correct
33 Correct 863 ms 159852 KB Output is correct
34 Correct 869 ms 159940 KB Output is correct
35 Correct 865 ms 159984 KB Output is correct
36 Correct 868 ms 159852 KB Output is correct
37 Correct 865 ms 159988 KB Output is correct
38 Correct 880 ms 160108 KB Output is correct
39 Correct 1301 ms 161100 KB Output is correct
40 Correct 1369 ms 160968 KB Output is correct
41 Correct 1354 ms 161096 KB Output is correct
42 Correct 55 ms 5228 KB Output is correct
43 Correct 34 ms 3820 KB Output is correct
44 Correct 40 ms 5484 KB Output is correct
45 Correct 20 ms 4224 KB Output is correct
46 Correct 10 ms 3820 KB Output is correct
47 Correct 15 ms 5612 KB Output is correct
48 Correct 76 ms 11628 KB Output is correct
49 Correct 51 ms 7108 KB Output is correct
50 Correct 39 ms 9580 KB Output is correct
51 Correct 34 ms 9196 KB Output is correct
52 Correct 35 ms 9068 KB Output is correct
53 Correct 30 ms 7404 KB Output is correct
54 Correct 61 ms 5612 KB Output is correct
55 Correct 61 ms 5612 KB Output is correct
56 Correct 41 ms 5612 KB Output is correct
57 Correct 21 ms 5612 KB Output is correct
58 Correct 16 ms 5612 KB Output is correct
59 Correct 15 ms 5612 KB Output is correct
60 Correct 105 ms 12648 KB Output is correct
61 Correct 104 ms 12524 KB Output is correct
62 Correct 92 ms 12652 KB Output is correct
63 Correct 102 ms 12524 KB Output is correct
64 Correct 92 ms 12524 KB Output is correct
65 Correct 92 ms 12524 KB Output is correct
66 Correct 44 ms 11756 KB Output is correct
67 Correct 43 ms 11756 KB Output is correct
68 Correct 52 ms 11756 KB Output is correct
69 Correct 2 ms 1132 KB Output is correct
70 Correct 2 ms 748 KB Output is correct
71 Correct 2 ms 1132 KB Output is correct
72 Correct 2 ms 1148 KB Output is correct
73 Correct 2 ms 1132 KB Output is correct
74 Correct 2 ms 1132 KB Output is correct
75 Correct 2 ms 1132 KB Output is correct
76 Correct 2 ms 1132 KB Output is correct
77 Correct 2 ms 1260 KB Output is correct
78 Correct 5 ms 1388 KB Output is correct
79 Correct 5 ms 1388 KB Output is correct
80 Correct 2 ms 1260 KB Output is correct
81 Correct 3 ms 1388 KB Output is correct
82 Correct 3 ms 1388 KB Output is correct
83 Correct 1 ms 748 KB Output is correct
84 Correct 3 ms 1132 KB Output is correct
85 Correct 1 ms 748 KB Output is correct
86 Correct 3 ms 1388 KB Output is correct
87 Correct 1 ms 748 KB Output is correct
88 Correct 2 ms 1260 KB Output is correct
89 Correct 1 ms 1132 KB Output is correct
90 Correct 3 ms 1276 KB Output is correct
91 Correct 4 ms 1260 KB Output is correct
92 Correct 2 ms 1260 KB Output is correct
93 Correct 2 ms 1260 KB Output is correct
94 Correct 2 ms 1260 KB Output is correct
95 Correct 3 ms 1516 KB Output is correct
96 Correct 3 ms 1516 KB Output is correct
97 Correct 3 ms 1516 KB Output is correct
98 Correct 4 ms 1516 KB Output is correct
99 Correct 4 ms 1516 KB Output is correct
100 Correct 5 ms 1516 KB Output is correct
101 Correct 2 ms 748 KB Output is correct
102 Correct 3 ms 1516 KB Output is correct
103 Correct 2 ms 748 KB Output is correct
104 Correct 5 ms 1516 KB Output is correct
105 Correct 2 ms 876 KB Output is correct
106 Correct 3 ms 1516 KB Output is correct
107 Correct 2 ms 1260 KB Output is correct
108 Correct 2 ms 1260 KB Output is correct
109 Correct 3 ms 1388 KB Output is correct
110 Correct 2 ms 1260 KB Output is correct
111 Correct 3 ms 1388 KB Output is correct
112 Correct 6 ms 1644 KB Output is correct
113 Correct 6 ms 1516 KB Output is correct
114 Correct 5 ms 1388 KB Output is correct
115 Correct 3 ms 1260 KB Output is correct
116 Correct 5 ms 1388 KB Output is correct
117 Correct 5 ms 1516 KB Output is correct
118 Correct 15 ms 2284 KB Output is correct
119 Correct 18 ms 2412 KB Output is correct
120 Correct 19 ms 2668 KB Output is correct
121 Correct 3 ms 1516 KB Output is correct
122 Correct 4 ms 1516 KB Output is correct
123 Correct 3 ms 1516 KB Output is correct
124 Correct 3 ms 1516 KB Output is correct
125 Correct 3 ms 1516 KB Output is correct
126 Correct 7 ms 1772 KB Output is correct
127 Correct 7 ms 1772 KB Output is correct
128 Correct 7 ms 1772 KB Output is correct
129 Correct 7 ms 1772 KB Output is correct
130 Correct 7 ms 1772 KB Output is correct
131 Correct 7 ms 1772 KB Output is correct
132 Correct 22 ms 2828 KB Output is correct
133 Correct 22 ms 2796 KB Output is correct
134 Correct 23 ms 2796 KB Output is correct
135 Correct 14 ms 3180 KB Output is correct
136 Correct 100 ms 37408 KB Output is correct
137 Correct 111 ms 33252 KB Output is correct
138 Correct 109 ms 32748 KB Output is correct
139 Correct 161 ms 46444 KB Output is correct
140 Correct 154 ms 42144 KB Output is correct
141 Correct 370 ms 46116 KB Output is correct
142 Correct 61 ms 5484 KB Output is correct
143 Correct 543 ms 55604 KB Output is correct
144 Correct 295 ms 32236 KB Output is correct
145 Correct 90 ms 7660 KB Output is correct
146 Correct 606 ms 87152 KB Output is correct
147 Correct 15 ms 2284 KB Output is correct
148 Correct 444 ms 93292 KB Output is correct
149 Correct 18 ms 2540 KB Output is correct
150 Correct 174 ms 27580 KB Output is correct
151 Correct 20 ms 2668 KB Output is correct
152 Correct 140 ms 14444 KB Output is correct
153 Correct 30 ms 3820 KB Output is correct
154 Correct 333 ms 41836 KB Output is correct
155 Correct 98 ms 9580 KB Output is correct
156 Correct 123 ms 13320 KB Output is correct
157 Correct 15 ms 3180 KB Output is correct
158 Correct 144 ms 52460 KB Output is correct
159 Correct 222 ms 65652 KB Output is correct
160 Correct 264 ms 73804 KB Output is correct
161 Correct 285 ms 80364 KB Output is correct
162 Correct 308 ms 86180 KB Output is correct
163 Correct 1183 ms 160704 KB Output is correct
164 Correct 1290 ms 160832 KB Output is correct
165 Correct 1231 ms 160876 KB Output is correct
166 Correct 1199 ms 160908 KB Output is correct
167 Correct 1210 ms 160832 KB Output is correct
168 Correct 1186 ms 160832 KB Output is correct
169 Correct 24 ms 3308 KB Output is correct
170 Correct 858 ms 159980 KB Output is correct
171 Correct 25 ms 3308 KB Output is correct
172 Correct 863 ms 159968 KB Output is correct
173 Correct 28 ms 3308 KB Output is correct
174 Correct 858 ms 159968 KB Output is correct
175 Correct 935 ms 160148 KB Output is correct
176 Correct 563 ms 81900 KB Output is correct
177 Correct 413 ms 55404 KB Output is correct
178 Correct 389 ms 42604 KB Output is correct
179 Correct 39 ms 3948 KB Output is correct
180 Correct 164 ms 3436 KB Output is correct
181 Execution timed out 1581 ms 4588 KB Time limit exceeded
182 Halted 0 ms 0 KB -