답안 #996330

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
996330 2024-06-10T13:03:47 Z Dan4Life 벽 칠하기 (APIO20_paint) C++17
12 / 100
23 ms 7256 KB
#include "paint.h"
#include <bits/stdc++.h>
using namespace std;

int n, m, k;
int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A, vector<vector<int>> B) {
	n = N, m = M, k = K;
	int tot = 0;
	for(int y = 0; y <= N-M; ){
		int x = -1; tot++;
		for(int i = 0; i < M; i++){
			for(auto col : B[i])
				if(col==C[y]) x=i;
		}
		if(x==-1) return -1;
		for(int i = 0; i < M; i++){
			bool found = false;
			for(auto col : B[x])
				if(col==C[y]) found = true;
			if(!found) return -1;
			
			x++; if(x==M) x=0;
			y++; if(y==N) break;
		}
		if(y==N) break;
        if(y>N-M) y = N-M;
	}
	return tot;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 6 ms 1036 KB Output is correct
23 Correct 6 ms 1116 KB Output is correct
24 Correct 7 ms 1124 KB Output is correct
25 Correct 2 ms 344 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 2 ms 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
29 Correct 2 ms 348 KB Output is correct
30 Correct 1 ms 348 KB Output is correct
31 Correct 4 ms 860 KB Output is correct
32 Correct 4 ms 776 KB Output is correct
33 Correct 3 ms 860 KB Output is correct
34 Correct 4 ms 860 KB Output is correct
35 Correct 3 ms 860 KB Output is correct
36 Correct 5 ms 856 KB Output is correct
37 Correct 8 ms 1372 KB Output is correct
38 Correct 8 ms 1372 KB Output is correct
39 Correct 8 ms 1372 KB Output is correct
40 Correct 5 ms 1116 KB Output is correct
41 Correct 6 ms 860 KB Output is correct
42 Correct 6 ms 1116 KB Output is correct
43 Correct 4 ms 860 KB Output is correct
44 Correct 4 ms 860 KB Output is correct
45 Correct 6 ms 1116 KB Output is correct
46 Correct 20 ms 6672 KB Output is correct
47 Correct 11 ms 3676 KB Output is correct
48 Correct 22 ms 5992 KB Output is correct
49 Correct 21 ms 5468 KB Output is correct
50 Correct 16 ms 4956 KB Output is correct
51 Correct 13 ms 3164 KB Output is correct
52 Correct 6 ms 1088 KB Output is correct
53 Correct 5 ms 1092 KB Output is correct
54 Correct 6 ms 1116 KB Output is correct
55 Correct 5 ms 1092 KB Output is correct
56 Correct 5 ms 1116 KB Output is correct
57 Correct 6 ms 1092 KB Output is correct
58 Correct 23 ms 7032 KB Output is correct
59 Correct 21 ms 6996 KB Output is correct
60 Correct 20 ms 7004 KB Output is correct
61 Correct 21 ms 6896 KB Output is correct
62 Correct 22 ms 7256 KB Output is correct
63 Correct 21 ms 6960 KB Output is correct
64 Correct 22 ms 6224 KB Output is correct
65 Correct 21 ms 6232 KB Output is correct
66 Correct 21 ms 6236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Incorrect 0 ms 348 KB Output isn't correct
23 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -