Submission #996326

# Submission time Handle Problem Language Result Execution time Memory
996326 2024-06-10T12:58:34 Z Dan4Life Painting Walls (APIO20_paint) C++17
12 / 100
25 ms 8308 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;
	}
	return (N+M-1)/M;
}
# Verdict Execution time Memory 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 0 ms 436 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 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 7 ms 1772 KB Output is correct
23 Correct 7 ms 1880 KB Output is correct
24 Correct 8 ms 1628 KB Output is correct
25 Correct 1 ms 604 KB Output is correct
26 Correct 1 ms 604 KB Output is correct
27 Correct 2 ms 556 KB Output is correct
28 Correct 1 ms 604 KB Output is correct
29 Correct 3 ms 604 KB Output is correct
30 Correct 1 ms 604 KB Output is correct
31 Correct 4 ms 1092 KB Output is correct
32 Correct 3 ms 1116 KB Output is correct
33 Correct 4 ms 1112 KB Output is correct
34 Correct 4 ms 1116 KB Output is correct
35 Correct 3 ms 1116 KB Output is correct
36 Correct 4 ms 1064 KB Output is correct
37 Correct 9 ms 2156 KB Output is correct
38 Correct 9 ms 2136 KB Output is correct
39 Correct 9 ms 2140 KB Output is correct
40 Correct 6 ms 1116 KB Output is correct
41 Correct 4 ms 860 KB Output is correct
42 Correct 6 ms 1212 KB Output is correct
43 Correct 4 ms 860 KB Output is correct
44 Correct 3 ms 860 KB Output is correct
45 Correct 8 ms 1456 KB Output is correct
46 Correct 19 ms 7680 KB Output is correct
47 Correct 11 ms 4228 KB Output is correct
48 Correct 14 ms 6920 KB Output is correct
49 Correct 17 ms 6236 KB Output is correct
50 Correct 24 ms 5964 KB Output is correct
51 Correct 14 ms 4188 KB Output is correct
52 Correct 5 ms 1288 KB Output is correct
53 Correct 5 ms 1372 KB Output is correct
54 Correct 6 ms 1372 KB Output is correct
55 Correct 6 ms 1372 KB Output is correct
56 Correct 5 ms 1372 KB Output is correct
57 Correct 6 ms 1372 KB Output is correct
58 Correct 25 ms 8308 KB Output is correct
59 Correct 20 ms 8284 KB Output is correct
60 Correct 20 ms 8192 KB Output is correct
61 Correct 22 ms 8284 KB Output is correct
62 Correct 22 ms 8284 KB Output is correct
63 Correct 22 ms 8112 KB Output is correct
64 Correct 22 ms 7512 KB Output is correct
65 Correct 21 ms 7492 KB Output is correct
66 Correct 22 ms 7516 KB Output is correct
# Verdict Execution time Memory 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 0 ms 436 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 440 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 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 344 KB Output isn't correct
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -