답안 #996473

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
996473 2024-06-10T16:44:31 Z Dan4Life 벽 칠하기 (APIO20_paint) C++17
28 / 100
1500 ms 19544 KB
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;
 
#define all(a) begin(a),end(a)
#define sz(a) (int)a.size()
#define pb push_back
 
const int mxN = (int)2e5+10; 
int n, m, k;
bool work[mxN];
vector<int> c, a;
set<int> b[mxN];
 
bool check(int i){
	for(int st = 0; st < m; st++){
		int x = st, y = i, flag = 1;
		for(int i = 0; i < m and flag; i++){
			if(!b[x].count(c[y])) flag = 0;
			x++; if(x==m) x=0;
			y++; if(y==n) break;
		}
		if(flag) return true;
	}
	return false;
}
 
int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) {
	n = N, m = M, k = K;
	for(auto u : C) c.pb(u);
	for(auto u : A) a.pb(u);
	for(int i = 0; i < m; i++)
		for(auto u : B[i]) b[i].insert(u);
	memset(work,0,sizeof(work));
	for(int i = 0; i <= n-m; i++) work[i] = check(i);
	if(!work[0] or !work[n-m]) return -1;
	
	int tot = 1;
	for(int i = 0; i < n-m;){
		int j;
		for(j = i+m; j>=i; j--)
			if(work[j]) break;
		if(j==i) return -1;
		tot++; i = j;
	}
	return tot;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 9816 KB Output is correct
2 Correct 2 ms 9820 KB Output is correct
3 Correct 2 ms 9820 KB Output is correct
4 Correct 2 ms 9820 KB Output is correct
5 Correct 2 ms 9820 KB Output is correct
6 Correct 2 ms 9820 KB Output is correct
7 Correct 2 ms 9820 KB Output is correct
8 Correct 2 ms 9820 KB Output is correct
9 Correct 2 ms 9820 KB Output is correct
10 Correct 2 ms 9836 KB Output is correct
11 Correct 2 ms 9820 KB Output is correct
12 Correct 2 ms 10072 KB Output is correct
13 Correct 2 ms 10076 KB Output is correct
14 Correct 2 ms 10076 KB Output is correct
15 Correct 2 ms 10076 KB Output is correct
16 Correct 2 ms 10076 KB Output is correct
17 Correct 2 ms 9836 KB Output is correct
18 Correct 2 ms 10076 KB Output is correct
19 Correct 2 ms 10076 KB Output is correct
20 Correct 3 ms 10076 KB Output is correct
21 Correct 3 ms 9888 KB Output is correct
22 Correct 20 ms 16216 KB Output is correct
23 Correct 21 ms 15964 KB Output is correct
24 Correct 21 ms 15964 KB Output is correct
25 Correct 3 ms 10332 KB Output is correct
26 Correct 3 ms 10332 KB Output is correct
27 Correct 4 ms 10380 KB Output is correct
28 Correct 3 ms 10332 KB Output is correct
29 Correct 3 ms 10332 KB Output is correct
30 Correct 4 ms 10584 KB Output is correct
31 Correct 601 ms 11612 KB Output is correct
32 Correct 591 ms 11648 KB Output is correct
33 Correct 636 ms 11612 KB Output is correct
34 Correct 594 ms 11612 KB Output is correct
35 Correct 615 ms 11648 KB Output is correct
36 Correct 618 ms 11612 KB Output is correct
37 Execution timed out 1511 ms 16472 KB Time limit exceeded
38 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 9816 KB Output is correct
2 Correct 2 ms 9820 KB Output is correct
3 Correct 2 ms 9820 KB Output is correct
4 Correct 2 ms 9820 KB Output is correct
5 Correct 2 ms 9820 KB Output is correct
6 Correct 2 ms 9820 KB Output is correct
7 Correct 2 ms 9820 KB Output is correct
8 Correct 2 ms 9820 KB Output is correct
9 Correct 2 ms 9820 KB Output is correct
10 Correct 2 ms 9836 KB Output is correct
11 Correct 2 ms 9820 KB Output is correct
12 Correct 2 ms 10072 KB Output is correct
13 Correct 2 ms 10076 KB Output is correct
14 Correct 2 ms 10076 KB Output is correct
15 Correct 2 ms 10076 KB Output is correct
16 Correct 2 ms 10076 KB Output is correct
17 Correct 2 ms 9836 KB Output is correct
18 Correct 2 ms 10076 KB Output is correct
19 Correct 2 ms 10076 KB Output is correct
20 Correct 3 ms 10076 KB Output is correct
21 Correct 3 ms 9888 KB Output is correct
22 Correct 2 ms 9820 KB Output is correct
23 Correct 2 ms 9820 KB Output is correct
24 Correct 2 ms 9820 KB Output is correct
25 Correct 2 ms 9820 KB Output is correct
26 Correct 2 ms 9820 KB Output is correct
27 Correct 2 ms 10028 KB Output is correct
28 Correct 2 ms 9820 KB Output is correct
29 Correct 2 ms 9820 KB Output is correct
30 Correct 2 ms 9820 KB Output is correct
31 Correct 2 ms 9820 KB Output is correct
32 Correct 2 ms 9820 KB Output is correct
33 Correct 2 ms 10076 KB Output is correct
34 Correct 2 ms 10076 KB Output is correct
35 Correct 2 ms 9816 KB Output is correct
36 Correct 2 ms 10072 KB Output is correct
37 Correct 2 ms 9820 KB Output is correct
38 Correct 2 ms 10076 KB Output is correct
39 Correct 2 ms 9820 KB Output is correct
40 Correct 2 ms 10076 KB Output is correct
41 Correct 2 ms 9820 KB Output is correct
42 Correct 2 ms 10084 KB Output is correct
43 Correct 2 ms 9820 KB Output is correct
44 Correct 2 ms 9820 KB Output is correct
45 Correct 2 ms 9820 KB Output is correct
46 Correct 2 ms 9836 KB Output is correct
47 Correct 2 ms 9820 KB Output is correct
48 Correct 2 ms 9820 KB Output is correct
49 Correct 2 ms 9820 KB Output is correct
50 Correct 3 ms 10076 KB Output is correct
51 Correct 2 ms 10076 KB Output is correct
52 Correct 2 ms 10076 KB Output is correct
53 Correct 2 ms 10076 KB Output is correct
54 Correct 2 ms 10076 KB Output is correct
55 Correct 2 ms 10076 KB Output is correct
56 Correct 2 ms 10076 KB Output is correct
57 Correct 2 ms 10076 KB Output is correct
58 Correct 3 ms 10096 KB Output is correct
59 Correct 2 ms 9844 KB Output is correct
60 Correct 2 ms 10076 KB Output is correct
61 Correct 2 ms 10076 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 9820 KB Output is correct
2 Correct 2 ms 9820 KB Output is correct
3 Correct 2 ms 9816 KB Output is correct
4 Correct 2 ms 9820 KB Output is correct
5 Correct 2 ms 9820 KB Output is correct
6 Correct 2 ms 9820 KB Output is correct
7 Correct 2 ms 9820 KB Output is correct
8 Correct 2 ms 9820 KB Output is correct
9 Correct 2 ms 9820 KB Output is correct
10 Correct 2 ms 9820 KB Output is correct
11 Correct 2 ms 9820 KB Output is correct
12 Correct 2 ms 9836 KB Output is correct
13 Correct 2 ms 9820 KB Output is correct
14 Correct 2 ms 10072 KB Output is correct
15 Correct 2 ms 10076 KB Output is correct
16 Correct 2 ms 10076 KB Output is correct
17 Correct 2 ms 10076 KB Output is correct
18 Correct 2 ms 10076 KB Output is correct
19 Correct 2 ms 9836 KB Output is correct
20 Correct 2 ms 10076 KB Output is correct
21 Correct 2 ms 10076 KB Output is correct
22 Correct 3 ms 10076 KB Output is correct
23 Correct 3 ms 9888 KB Output is correct
24 Correct 20 ms 16216 KB Output is correct
25 Correct 21 ms 15964 KB Output is correct
26 Correct 21 ms 15964 KB Output is correct
27 Correct 2 ms 9820 KB Output is correct
28 Correct 2 ms 9820 KB Output is correct
29 Correct 2 ms 9820 KB Output is correct
30 Correct 2 ms 10028 KB Output is correct
31 Correct 2 ms 9820 KB Output is correct
32 Correct 2 ms 9820 KB Output is correct
33 Correct 2 ms 9820 KB Output is correct
34 Correct 2 ms 9820 KB Output is correct
35 Correct 2 ms 9820 KB Output is correct
36 Correct 2 ms 10076 KB Output is correct
37 Correct 2 ms 10076 KB Output is correct
38 Correct 2 ms 9816 KB Output is correct
39 Correct 2 ms 10072 KB Output is correct
40 Correct 2 ms 9820 KB Output is correct
41 Correct 2 ms 10076 KB Output is correct
42 Correct 2 ms 9820 KB Output is correct
43 Correct 2 ms 10076 KB Output is correct
44 Correct 2 ms 9820 KB Output is correct
45 Correct 2 ms 10084 KB Output is correct
46 Correct 2 ms 9820 KB Output is correct
47 Correct 2 ms 9820 KB Output is correct
48 Correct 2 ms 9820 KB Output is correct
49 Correct 2 ms 9836 KB Output is correct
50 Correct 2 ms 9820 KB Output is correct
51 Correct 2 ms 9820 KB Output is correct
52 Correct 2 ms 9820 KB Output is correct
53 Correct 3 ms 10076 KB Output is correct
54 Correct 2 ms 10076 KB Output is correct
55 Correct 2 ms 10076 KB Output is correct
56 Correct 2 ms 10076 KB Output is correct
57 Correct 2 ms 10076 KB Output is correct
58 Correct 2 ms 10076 KB Output is correct
59 Correct 2 ms 10076 KB Output is correct
60 Correct 2 ms 10076 KB Output is correct
61 Correct 3 ms 10096 KB Output is correct
62 Correct 2 ms 9844 KB Output is correct
63 Correct 2 ms 10076 KB Output is correct
64 Correct 2 ms 10076 KB Output is correct
65 Correct 2 ms 9820 KB Output is correct
66 Correct 2 ms 9820 KB Output is correct
67 Correct 2 ms 9820 KB Output is correct
68 Correct 2 ms 9820 KB Output is correct
69 Correct 3 ms 10076 KB Output is correct
70 Correct 6 ms 10588 KB Output is correct
71 Correct 6 ms 10584 KB Output is correct
72 Correct 5 ms 10588 KB Output is correct
73 Correct 3 ms 10360 KB Output is correct
74 Correct 5 ms 10704 KB Output is correct
75 Correct 5 ms 10332 KB Output is correct
76 Correct 19 ms 16576 KB Output is correct
77 Correct 26 ms 17232 KB Output is correct
78 Correct 25 ms 18524 KB Output is correct
79 Correct 2 ms 9820 KB Output is correct
80 Correct 3 ms 10076 KB Output is correct
81 Correct 2 ms 10076 KB Output is correct
82 Correct 2 ms 10076 KB Output is correct
83 Correct 2 ms 10076 KB Output is correct
84 Correct 6 ms 10844 KB Output is correct
85 Correct 8 ms 10844 KB Output is correct
86 Correct 7 ms 10900 KB Output is correct
87 Correct 6 ms 10844 KB Output is correct
88 Correct 6 ms 10844 KB Output is correct
89 Correct 6 ms 10840 KB Output is correct
90 Correct 34 ms 19544 KB Output is correct
91 Correct 28 ms 19292 KB Output is correct
92 Correct 30 ms 19424 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 9820 KB Output is correct
2 Correct 2 ms 9820 KB Output is correct
3 Correct 2 ms 9816 KB Output is correct
4 Correct 2 ms 9820 KB Output is correct
5 Correct 2 ms 9820 KB Output is correct
6 Correct 2 ms 9820 KB Output is correct
7 Correct 2 ms 9820 KB Output is correct
8 Correct 2 ms 9820 KB Output is correct
9 Correct 2 ms 9820 KB Output is correct
10 Correct 2 ms 9820 KB Output is correct
11 Correct 2 ms 9820 KB Output is correct
12 Correct 2 ms 9836 KB Output is correct
13 Correct 2 ms 9820 KB Output is correct
14 Correct 2 ms 10072 KB Output is correct
15 Correct 2 ms 10076 KB Output is correct
16 Correct 2 ms 10076 KB Output is correct
17 Correct 2 ms 10076 KB Output is correct
18 Correct 2 ms 10076 KB Output is correct
19 Correct 2 ms 9836 KB Output is correct
20 Correct 2 ms 10076 KB Output is correct
21 Correct 2 ms 10076 KB Output is correct
22 Correct 3 ms 10076 KB Output is correct
23 Correct 3 ms 9888 KB Output is correct
24 Correct 20 ms 16216 KB Output is correct
25 Correct 21 ms 15964 KB Output is correct
26 Correct 21 ms 15964 KB Output is correct
27 Correct 3 ms 10332 KB Output is correct
28 Correct 3 ms 10332 KB Output is correct
29 Correct 4 ms 10380 KB Output is correct
30 Correct 3 ms 10332 KB Output is correct
31 Correct 3 ms 10332 KB Output is correct
32 Correct 4 ms 10584 KB Output is correct
33 Correct 601 ms 11612 KB Output is correct
34 Correct 591 ms 11648 KB Output is correct
35 Correct 636 ms 11612 KB Output is correct
36 Correct 594 ms 11612 KB Output is correct
37 Correct 615 ms 11648 KB Output is correct
38 Correct 618 ms 11612 KB Output is correct
39 Execution timed out 1511 ms 16472 KB Time limit exceeded
40 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 9820 KB Output is correct
2 Correct 2 ms 9820 KB Output is correct
3 Correct 2 ms 9816 KB Output is correct
4 Correct 2 ms 9820 KB Output is correct
5 Correct 2 ms 9820 KB Output is correct
6 Correct 2 ms 9820 KB Output is correct
7 Correct 2 ms 9820 KB Output is correct
8 Correct 2 ms 9820 KB Output is correct
9 Correct 2 ms 9820 KB Output is correct
10 Correct 2 ms 9820 KB Output is correct
11 Correct 2 ms 9820 KB Output is correct
12 Correct 2 ms 9836 KB Output is correct
13 Correct 2 ms 9820 KB Output is correct
14 Correct 2 ms 10072 KB Output is correct
15 Correct 2 ms 10076 KB Output is correct
16 Correct 2 ms 10076 KB Output is correct
17 Correct 2 ms 10076 KB Output is correct
18 Correct 2 ms 10076 KB Output is correct
19 Correct 2 ms 9836 KB Output is correct
20 Correct 2 ms 10076 KB Output is correct
21 Correct 2 ms 10076 KB Output is correct
22 Correct 3 ms 10076 KB Output is correct
23 Correct 3 ms 9888 KB Output is correct
24 Correct 20 ms 16216 KB Output is correct
25 Correct 21 ms 15964 KB Output is correct
26 Correct 21 ms 15964 KB Output is correct
27 Correct 3 ms 10332 KB Output is correct
28 Correct 3 ms 10332 KB Output is correct
29 Correct 4 ms 10380 KB Output is correct
30 Correct 3 ms 10332 KB Output is correct
31 Correct 3 ms 10332 KB Output is correct
32 Correct 4 ms 10584 KB Output is correct
33 Correct 601 ms 11612 KB Output is correct
34 Correct 591 ms 11648 KB Output is correct
35 Correct 636 ms 11612 KB Output is correct
36 Correct 594 ms 11612 KB Output is correct
37 Correct 615 ms 11648 KB Output is correct
38 Correct 618 ms 11612 KB Output is correct
39 Execution timed out 1511 ms 16472 KB Time limit exceeded
40 Halted 0 ms 0 KB -