Submission #899189

# Submission time Handle Problem Language Result Execution time Memory
899189 2024-01-05T15:06:52 Z LCJLY Painting Walls (APIO20_paint) C++14
12 / 100
92 ms 36736 KB
#include "paint.h"

#include <bits/stdc++.h>
#define show(x,y) cout << y << " " << #x << endl;
#define show2(x,y,i,j) cout << y << " " << #x << "  " << j << " " << #i << endl;
#define show3(x,y,i,j,p,q) cout << y << " " << #x << "  " << j << " " << #i << "  " << q << " " << #p << endl; 
#define show4(x,y) for(auto it:x) cout << it << " "; cout << #y << endl;

using namespace std;
int arr[100005];
int n,m,k;
unordered_set<int>check[100005];
vector<int>color[100005];

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(int x=0;x<n;x++){
		arr[x]=C[x];
	}
	
	for(int x=0;x<m;x++){
		for(int y=0;y<A[x];y++){
			check[x].insert(B[x][y]);
			check[x+m].insert(B[x][y]);
			color[B[x][y]].push_back(x);
		}
	}
	
	if(color[arr[0]].empty()) return -1;
	int pos=color[arr[0]][0];
	bool amos=true;
	for(int x=0;x<n;x++){
		if(check[pos].find(arr[x])==check[pos].end()) amos=false;
		pos=(pos+1)%m;
	}
	
	if(amos){
		return (n+m-1)/m;
	}
	else return -1;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8028 KB Output is correct
2 Correct 2 ms 8028 KB Output is correct
3 Correct 2 ms 8028 KB Output is correct
4 Correct 2 ms 8028 KB Output is correct
5 Correct 3 ms 8028 KB Output is correct
6 Correct 2 ms 8028 KB Output is correct
7 Correct 3 ms 8028 KB Output is correct
8 Correct 2 ms 8028 KB Output is correct
9 Correct 2 ms 8028 KB Output is correct
10 Correct 2 ms 8024 KB Output is correct
11 Correct 2 ms 8028 KB Output is correct
12 Correct 4 ms 8028 KB Output is correct
13 Correct 3 ms 8284 KB Output is correct
14 Correct 4 ms 8284 KB Output is correct
15 Correct 2 ms 8280 KB Output is correct
16 Correct 3 ms 8284 KB Output is correct
17 Correct 4 ms 8280 KB Output is correct
18 Correct 2 ms 8284 KB Output is correct
19 Correct 3 ms 8536 KB Output is correct
20 Correct 3 ms 8376 KB Output is correct
21 Correct 3 ms 8284 KB Output is correct
22 Correct 33 ms 19980 KB Output is correct
23 Correct 41 ms 20036 KB Output is correct
24 Correct 40 ms 20124 KB Output is correct
25 Correct 6 ms 8284 KB Output is correct
26 Correct 4 ms 8284 KB Output is correct
27 Correct 4 ms 8280 KB Output is correct
28 Correct 4 ms 8284 KB Output is correct
29 Correct 4 ms 8284 KB Output is correct
30 Correct 4 ms 8288 KB Output is correct
31 Correct 13 ms 11112 KB Output is correct
32 Correct 10 ms 11100 KB Output is correct
33 Correct 14 ms 11096 KB Output is correct
34 Correct 10 ms 11100 KB Output is correct
35 Correct 10 ms 11100 KB Output is correct
36 Correct 10 ms 11108 KB Output is correct
37 Correct 52 ms 20828 KB Output is correct
38 Correct 50 ms 20880 KB Output is correct
39 Correct 48 ms 20920 KB Output is correct
40 Correct 11 ms 9308 KB Output is correct
41 Correct 6 ms 8796 KB Output is correct
42 Correct 11 ms 9432 KB Output is correct
43 Correct 10 ms 8796 KB Output is correct
44 Correct 7 ms 8796 KB Output is correct
45 Correct 10 ms 9436 KB Output is correct
46 Correct 70 ms 33680 KB Output is correct
47 Correct 39 ms 22940 KB Output is correct
48 Correct 58 ms 30264 KB Output is correct
49 Correct 71 ms 30800 KB Output is correct
50 Correct 62 ms 29524 KB Output is correct
51 Correct 56 ms 23124 KB Output is correct
52 Correct 9 ms 9564 KB Output is correct
53 Correct 12 ms 9564 KB Output is correct
54 Correct 13 ms 9632 KB Output is correct
55 Correct 10 ms 9564 KB Output is correct
56 Correct 11 ms 9560 KB Output is correct
57 Correct 10 ms 9628 KB Output is correct
58 Correct 75 ms 36736 KB Output is correct
59 Correct 80 ms 36684 KB Output is correct
60 Correct 86 ms 36700 KB Output is correct
61 Correct 92 ms 36716 KB Output is correct
62 Correct 74 ms 36692 KB Output is correct
63 Correct 74 ms 36692 KB Output is correct
64 Correct 78 ms 34388 KB Output is correct
65 Correct 74 ms 34384 KB Output is correct
66 Correct 74 ms 34496 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 8028 KB Output is correct
2 Correct 2 ms 8028 KB Output is correct
3 Correct 2 ms 8028 KB Output is correct
4 Correct 2 ms 8028 KB Output is correct
5 Correct 3 ms 8028 KB Output is correct
6 Correct 2 ms 8028 KB Output is correct
7 Correct 3 ms 8028 KB Output is correct
8 Correct 2 ms 8028 KB Output is correct
9 Correct 2 ms 8028 KB Output is correct
10 Correct 2 ms 8024 KB Output is correct
11 Correct 2 ms 8028 KB Output is correct
12 Correct 4 ms 8028 KB Output is correct
13 Correct 3 ms 8284 KB Output is correct
14 Correct 4 ms 8284 KB Output is correct
15 Correct 2 ms 8280 KB Output is correct
16 Correct 3 ms 8284 KB Output is correct
17 Correct 4 ms 8280 KB Output is correct
18 Correct 2 ms 8284 KB Output is correct
19 Correct 3 ms 8536 KB Output is correct
20 Correct 3 ms 8376 KB Output is correct
21 Correct 3 ms 8284 KB Output is correct
22 Incorrect 2 ms 8040 KB Output isn't correct
23 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 8040 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 8040 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 8040 KB Output isn't correct
2 Halted 0 ms 0 KB -