# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1106165 | 2024-10-29T12:15:54 Z | vladilius | 벽 칠하기 (APIO20_paint) | C++17 | 360 ms | 524288 KB |
#include <bits/stdc++.h> using namespace std; using ll = long long; using pii = pair<int, int>; #define pb push_back #define ff first #define ss second int minimumInstructions(int n, int m, int k, vector<int> x, vector<int> A, vector<vector<int>> B){ vector<vector<bool>> f(m, vector<bool>(k)); for (int i = 0; i < m; i++){ for (int j: B[i]){ f[i][j] = 1; } } vector<int> T[n]; for (int i = 0; i < n; i++){ for (int j = 0; j < m; j++){ if (f[j][x[i]]){ T[i].pb(j); } } int q = (int) T[i].size(); for (int j = 0; j < q; j++){ T[i].pb(T[i][j] + m); } for (int j = 0; j < T[i].size(); j++) T[i][j] -= i; } map<int, vector<int>> mp; for (int i = 0; i < n; i++){ for (int j: T[i]){ mp[j].pb(i); } } vector<bool> gd(n); for (auto [y, V]: mp){ int pre = 0; for (int i = 1; i < V.size(); i++){ if (V[i] != (V[i - 1] + 1)){ for (int j = V[pre]; j <= V[i - 1] - m + 1; j++) gd[j] = 1; pre = i; } } for (int j = V[pre]; j <= V.back() - m + 1; j++) gd[j] = 1; } int mx = -1, t = 0, out = 0; for (int i = 0; i < n; i++){ if (gd[i]) t = max(t, i); if (i == (mx + 1)){ if (t == -1) return -1; mx = t + m - 1; t = -1; out++; } } return out; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 504 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 504 KB | Output is correct |
13 | Correct | 3 ms | 2896 KB | Output is correct |
14 | Correct | 3 ms | 2896 KB | Output is correct |
15 | Correct | 3 ms | 2896 KB | Output is correct |
16 | Correct | 3 ms | 2896 KB | Output is correct |
17 | Correct | 3 ms | 2896 KB | Output is correct |
18 | Correct | 4 ms | 2896 KB | Output is correct |
19 | Correct | 3 ms | 2740 KB | Output is correct |
20 | Correct | 3 ms | 2896 KB | Output is correct |
21 | Correct | 3 ms | 2896 KB | Output is correct |
22 | Correct | 11 ms | 4284 KB | Output is correct |
23 | Correct | 10 ms | 4176 KB | Output is correct |
24 | Correct | 10 ms | 4176 KB | Output is correct |
25 | Correct | 11 ms | 3664 KB | Output is correct |
26 | Correct | 11 ms | 3664 KB | Output is correct |
27 | Correct | 11 ms | 3664 KB | Output is correct |
28 | Correct | 9 ms | 3664 KB | Output is correct |
29 | Correct | 10 ms | 3664 KB | Output is correct |
30 | Correct | 10 ms | 3676 KB | Output is correct |
31 | Correct | 234 ms | 26748 KB | Output is correct |
32 | Correct | 184 ms | 26732 KB | Output is correct |
33 | Correct | 198 ms | 26952 KB | Output is correct |
34 | Correct | 184 ms | 26952 KB | Output is correct |
35 | Correct | 194 ms | 26952 KB | Output is correct |
36 | Correct | 232 ms | 26952 KB | Output is correct |
37 | Correct | 264 ms | 29860 KB | Output is correct |
38 | Correct | 264 ms | 29840 KB | Output is correct |
39 | Correct | 246 ms | 29768 KB | Output is correct |
40 | Correct | 48 ms | 16208 KB | Output is correct |
41 | Correct | 31 ms | 10312 KB | Output is correct |
42 | Correct | 43 ms | 16712 KB | Output is correct |
43 | Correct | 29 ms | 11204 KB | Output is correct |
44 | Correct | 27 ms | 10076 KB | Output is correct |
45 | Correct | 58 ms | 16464 KB | Output is correct |
46 | Runtime error | 360 ms | 524288 KB | Execution killed with signal 9 |
47 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 504 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 504 KB | Output is correct |
13 | Correct | 3 ms | 2896 KB | Output is correct |
14 | Correct | 3 ms | 2896 KB | Output is correct |
15 | Correct | 3 ms | 2896 KB | Output is correct |
16 | Correct | 3 ms | 2896 KB | Output is correct |
17 | Correct | 3 ms | 2896 KB | Output is correct |
18 | Correct | 4 ms | 2896 KB | Output is correct |
19 | Correct | 3 ms | 2740 KB | Output is correct |
20 | Correct | 3 ms | 2896 KB | Output is correct |
21 | Correct | 3 ms | 2896 KB | Output is correct |
22 | Correct | 1 ms | 336 KB | Output is correct |
23 | Correct | 1 ms | 336 KB | Output is correct |
24 | Correct | 1 ms | 336 KB | Output is correct |
25 | Incorrect | 1 ms | 336 KB | Output isn't correct |
26 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 504 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 1 ms | 504 KB | Output is correct |
15 | Correct | 3 ms | 2896 KB | Output is correct |
16 | Correct | 3 ms | 2896 KB | Output is correct |
17 | Correct | 3 ms | 2896 KB | Output is correct |
18 | Correct | 3 ms | 2896 KB | Output is correct |
19 | Correct | 3 ms | 2896 KB | Output is correct |
20 | Correct | 4 ms | 2896 KB | Output is correct |
21 | Correct | 3 ms | 2740 KB | Output is correct |
22 | Correct | 3 ms | 2896 KB | Output is correct |
23 | Correct | 3 ms | 2896 KB | Output is correct |
24 | Correct | 11 ms | 4284 KB | Output is correct |
25 | Correct | 10 ms | 4176 KB | Output is correct |
26 | Correct | 10 ms | 4176 KB | Output is correct |
27 | Correct | 1 ms | 336 KB | Output is correct |
28 | Incorrect | 1 ms | 336 KB | Output isn't correct |
29 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 504 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 1 ms | 504 KB | Output is correct |
15 | Correct | 3 ms | 2896 KB | Output is correct |
16 | Correct | 3 ms | 2896 KB | Output is correct |
17 | Correct | 3 ms | 2896 KB | Output is correct |
18 | Correct | 3 ms | 2896 KB | Output is correct |
19 | Correct | 3 ms | 2896 KB | Output is correct |
20 | Correct | 4 ms | 2896 KB | Output is correct |
21 | Correct | 3 ms | 2740 KB | Output is correct |
22 | Correct | 3 ms | 2896 KB | Output is correct |
23 | Correct | 3 ms | 2896 KB | Output is correct |
24 | Correct | 11 ms | 4284 KB | Output is correct |
25 | Correct | 10 ms | 4176 KB | Output is correct |
26 | Correct | 10 ms | 4176 KB | Output is correct |
27 | Correct | 11 ms | 3664 KB | Output is correct |
28 | Correct | 11 ms | 3664 KB | Output is correct |
29 | Correct | 11 ms | 3664 KB | Output is correct |
30 | Correct | 9 ms | 3664 KB | Output is correct |
31 | Correct | 10 ms | 3664 KB | Output is correct |
32 | Correct | 10 ms | 3676 KB | Output is correct |
33 | Correct | 234 ms | 26748 KB | Output is correct |
34 | Correct | 184 ms | 26732 KB | Output is correct |
35 | Correct | 198 ms | 26952 KB | Output is correct |
36 | Correct | 184 ms | 26952 KB | Output is correct |
37 | Correct | 194 ms | 26952 KB | Output is correct |
38 | Correct | 232 ms | 26952 KB | Output is correct |
39 | Correct | 264 ms | 29860 KB | Output is correct |
40 | Correct | 264 ms | 29840 KB | Output is correct |
41 | Correct | 246 ms | 29768 KB | Output is correct |
42 | Correct | 1 ms | 336 KB | Output is correct |
43 | Incorrect | 1 ms | 336 KB | Output isn't correct |
44 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 336 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 1 ms | 336 KB | Output is correct |
8 | Correct | 1 ms | 504 KB | Output is correct |
9 | Correct | 1 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 336 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 1 ms | 504 KB | Output is correct |
15 | Correct | 3 ms | 2896 KB | Output is correct |
16 | Correct | 3 ms | 2896 KB | Output is correct |
17 | Correct | 3 ms | 2896 KB | Output is correct |
18 | Correct | 3 ms | 2896 KB | Output is correct |
19 | Correct | 3 ms | 2896 KB | Output is correct |
20 | Correct | 4 ms | 2896 KB | Output is correct |
21 | Correct | 3 ms | 2740 KB | Output is correct |
22 | Correct | 3 ms | 2896 KB | Output is correct |
23 | Correct | 3 ms | 2896 KB | Output is correct |
24 | Correct | 11 ms | 4284 KB | Output is correct |
25 | Correct | 10 ms | 4176 KB | Output is correct |
26 | Correct | 10 ms | 4176 KB | Output is correct |
27 | Correct | 11 ms | 3664 KB | Output is correct |
28 | Correct | 11 ms | 3664 KB | Output is correct |
29 | Correct | 11 ms | 3664 KB | Output is correct |
30 | Correct | 9 ms | 3664 KB | Output is correct |
31 | Correct | 10 ms | 3664 KB | Output is correct |
32 | Correct | 10 ms | 3676 KB | Output is correct |
33 | Correct | 234 ms | 26748 KB | Output is correct |
34 | Correct | 184 ms | 26732 KB | Output is correct |
35 | Correct | 198 ms | 26952 KB | Output is correct |
36 | Correct | 184 ms | 26952 KB | Output is correct |
37 | Correct | 194 ms | 26952 KB | Output is correct |
38 | Correct | 232 ms | 26952 KB | Output is correct |
39 | Correct | 264 ms | 29860 KB | Output is correct |
40 | Correct | 264 ms | 29840 KB | Output is correct |
41 | Correct | 246 ms | 29768 KB | Output is correct |
42 | Correct | 48 ms | 16208 KB | Output is correct |
43 | Correct | 31 ms | 10312 KB | Output is correct |
44 | Correct | 43 ms | 16712 KB | Output is correct |
45 | Correct | 29 ms | 11204 KB | Output is correct |
46 | Correct | 27 ms | 10076 KB | Output is correct |
47 | Correct | 58 ms | 16464 KB | Output is correct |
48 | Runtime error | 360 ms | 524288 KB | Execution killed with signal 9 |
49 | Halted | 0 ms | 0 KB | - |