Submission #403639

# Submission time Handle Problem Language Result Execution time Memory
403639 2021-05-13T10:34:25 Z Waratpp123 Painting Walls (APIO20_paint) C++14
28 / 100
1500 ms 175444 KB
#include "paint.h"
#include <vector>
#include<bits/stdc++.h>
using namespace std;
unordered_map<int,int> mp[50010];
int mark[50010];
int minimumInstructions(
    int n, int m, int K, std::vector<int> C,
    std::vector<int> A, std::vector<std::vector<int>> B) {
    int i,j,cnt=0,k,ch,err;
    for(i=0;i<m;i++){
        for(auto x : B[i]){
            mp[i][x]=1;
        }
    }
    for(i=0;i<=n-m;i++){
        ch=0;
        for(j=0;j<m;j++){
            err=0;
            for(k=0;k<m;k++){
                if(mp[(j+k)%m][C[i+k]]==0){
                    err=1;
                    break;
                }
            }
            if(err==0){
                ch=1;
                break;
            }
        }
        mark[i]=ch;
    }
    i=0;
    cnt=0;
    int ans=0;
    while(i<n){
        cnt++;
        if(mark[i]==1){
            i+=m;
            ans++;
        }else i--;
        if(cnt==n+5) break;
    }
    if(cnt==n+5) return -1;
    return ans;
}
/*
8 3 5
3 3 1 3 4 4 2 2
3 0 1 2
2 2 3
2 3 4

5 4 4
1 0 1 2 2
2 0 1
1 1
1 2
1 3
*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3020 KB Output is correct
2 Correct 3 ms 3020 KB Output is correct
3 Correct 3 ms 3020 KB Output is correct
4 Correct 3 ms 3020 KB Output is correct
5 Correct 3 ms 3020 KB Output is correct
6 Correct 3 ms 3032 KB Output is correct
7 Correct 2 ms 3040 KB Output is correct
8 Correct 3 ms 3020 KB Output is correct
9 Correct 3 ms 3012 KB Output is correct
10 Correct 3 ms 3020 KB Output is correct
11 Correct 3 ms 3020 KB Output is correct
12 Correct 3 ms 3020 KB Output is correct
13 Correct 8 ms 4268 KB Output is correct
14 Correct 9 ms 4436 KB Output is correct
15 Correct 10 ms 4428 KB Output is correct
16 Correct 8 ms 4448 KB Output is correct
17 Correct 8 ms 4428 KB Output is correct
18 Correct 10 ms 4432 KB Output is correct
19 Correct 12 ms 5836 KB Output is correct
20 Correct 13 ms 5708 KB Output is correct
21 Correct 14 ms 5836 KB Output is correct
22 Correct 44 ms 11164 KB Output is correct
23 Correct 47 ms 11108 KB Output is correct
24 Correct 44 ms 11064 KB Output is correct
25 Correct 5 ms 3308 KB Output is correct
26 Correct 6 ms 3308 KB Output is correct
27 Correct 7 ms 3304 KB Output is correct
28 Correct 6 ms 3312 KB Output is correct
29 Correct 7 ms 3276 KB Output is correct
30 Correct 8 ms 3276 KB Output is correct
31 Execution timed out 1586 ms 175444 KB Time limit exceeded
32 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 3020 KB Output is correct
2 Correct 3 ms 3020 KB Output is correct
3 Correct 3 ms 3020 KB Output is correct
4 Correct 3 ms 3020 KB Output is correct
5 Correct 3 ms 3020 KB Output is correct
6 Correct 3 ms 3032 KB Output is correct
7 Correct 2 ms 3040 KB Output is correct
8 Correct 3 ms 3020 KB Output is correct
9 Correct 3 ms 3012 KB Output is correct
10 Correct 3 ms 3020 KB Output is correct
11 Correct 3 ms 3020 KB Output is correct
12 Correct 3 ms 3020 KB Output is correct
13 Correct 8 ms 4268 KB Output is correct
14 Correct 9 ms 4436 KB Output is correct
15 Correct 10 ms 4428 KB Output is correct
16 Correct 8 ms 4448 KB Output is correct
17 Correct 8 ms 4428 KB Output is correct
18 Correct 10 ms 4432 KB Output is correct
19 Correct 12 ms 5836 KB Output is correct
20 Correct 13 ms 5708 KB Output is correct
21 Correct 14 ms 5836 KB Output is correct
22 Correct 3 ms 3020 KB Output is correct
23 Correct 3 ms 3040 KB Output is correct
24 Correct 3 ms 3020 KB Output is correct
25 Correct 3 ms 3020 KB Output is correct
26 Correct 3 ms 3020 KB Output is correct
27 Correct 3 ms 3020 KB Output is correct
28 Correct 3 ms 3020 KB Output is correct
29 Correct 3 ms 3020 KB Output is correct
30 Correct 3 ms 3020 KB Output is correct
31 Correct 3 ms 3040 KB Output is correct
32 Correct 3 ms 3020 KB Output is correct
33 Correct 6 ms 3808 KB Output is correct
34 Correct 6 ms 3916 KB Output is correct
35 Correct 4 ms 3532 KB Output is correct
36 Correct 6 ms 3680 KB Output is correct
37 Correct 6 ms 3688 KB Output is correct
38 Correct 3 ms 3020 KB Output is correct
39 Correct 3 ms 3020 KB Output is correct
40 Correct 7 ms 4192 KB Output is correct
41 Correct 4 ms 3404 KB Output is correct
42 Correct 7 ms 4300 KB Output is correct
43 Correct 5 ms 3532 KB Output is correct
44 Correct 3 ms 3020 KB Output is correct
45 Correct 4 ms 3020 KB Output is correct
46 Correct 4 ms 3020 KB Output is correct
47 Correct 3 ms 3020 KB Output is correct
48 Correct 3 ms 3036 KB Output is correct
49 Correct 3 ms 3020 KB Output is correct
50 Correct 9 ms 4536 KB Output is correct
51 Correct 9 ms 4300 KB Output is correct
52 Correct 8 ms 4192 KB Output is correct
53 Correct 9 ms 4452 KB Output is correct
54 Correct 8 ms 4300 KB Output is correct
55 Correct 9 ms 4300 KB Output is correct
56 Correct 14 ms 5736 KB Output is correct
57 Correct 7 ms 3940 KB Output is correct
58 Correct 13 ms 5836 KB Output is correct
59 Correct 8 ms 4172 KB Output is correct
60 Correct 15 ms 5836 KB Output is correct
61 Correct 8 ms 4172 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3020 KB Output is correct
2 Correct 3 ms 3040 KB Output is correct
3 Correct 2 ms 3020 KB Output is correct
4 Correct 3 ms 3020 KB Output is correct
5 Correct 3 ms 3020 KB Output is correct
6 Correct 3 ms 3020 KB Output is correct
7 Correct 3 ms 3020 KB Output is correct
8 Correct 3 ms 3032 KB Output is correct
9 Correct 2 ms 3040 KB Output is correct
10 Correct 3 ms 3020 KB Output is correct
11 Correct 3 ms 3012 KB Output is correct
12 Correct 3 ms 3020 KB Output is correct
13 Correct 3 ms 3020 KB Output is correct
14 Correct 3 ms 3020 KB Output is correct
15 Correct 8 ms 4268 KB Output is correct
16 Correct 9 ms 4436 KB Output is correct
17 Correct 10 ms 4428 KB Output is correct
18 Correct 8 ms 4448 KB Output is correct
19 Correct 8 ms 4428 KB Output is correct
20 Correct 10 ms 4432 KB Output is correct
21 Correct 12 ms 5836 KB Output is correct
22 Correct 13 ms 5708 KB Output is correct
23 Correct 14 ms 5836 KB Output is correct
24 Correct 44 ms 11164 KB Output is correct
25 Correct 47 ms 11108 KB Output is correct
26 Correct 44 ms 11064 KB Output is correct
27 Correct 3 ms 3020 KB Output is correct
28 Correct 3 ms 3020 KB Output is correct
29 Correct 3 ms 3020 KB Output is correct
30 Correct 3 ms 3020 KB Output is correct
31 Correct 3 ms 3020 KB Output is correct
32 Correct 3 ms 3020 KB Output is correct
33 Correct 3 ms 3020 KB Output is correct
34 Correct 3 ms 3040 KB Output is correct
35 Correct 3 ms 3020 KB Output is correct
36 Correct 6 ms 3808 KB Output is correct
37 Correct 6 ms 3916 KB Output is correct
38 Correct 4 ms 3532 KB Output is correct
39 Correct 6 ms 3680 KB Output is correct
40 Correct 6 ms 3688 KB Output is correct
41 Correct 3 ms 3020 KB Output is correct
42 Correct 3 ms 3020 KB Output is correct
43 Correct 7 ms 4192 KB Output is correct
44 Correct 4 ms 3404 KB Output is correct
45 Correct 7 ms 4300 KB Output is correct
46 Correct 5 ms 3532 KB Output is correct
47 Correct 3 ms 3020 KB Output is correct
48 Correct 4 ms 3020 KB Output is correct
49 Correct 4 ms 3020 KB Output is correct
50 Correct 3 ms 3020 KB Output is correct
51 Correct 3 ms 3036 KB Output is correct
52 Correct 3 ms 3020 KB Output is correct
53 Correct 9 ms 4536 KB Output is correct
54 Correct 9 ms 4300 KB Output is correct
55 Correct 8 ms 4192 KB Output is correct
56 Correct 9 ms 4452 KB Output is correct
57 Correct 8 ms 4300 KB Output is correct
58 Correct 9 ms 4300 KB Output is correct
59 Correct 14 ms 5736 KB Output is correct
60 Correct 7 ms 3940 KB Output is correct
61 Correct 13 ms 5836 KB Output is correct
62 Correct 8 ms 4172 KB Output is correct
63 Correct 15 ms 5836 KB Output is correct
64 Correct 8 ms 4172 KB Output is correct
65 Correct 3 ms 3036 KB Output is correct
66 Correct 3 ms 3020 KB Output is correct
67 Correct 3 ms 3020 KB Output is correct
68 Correct 4 ms 3020 KB Output is correct
69 Correct 4 ms 3020 KB Output is correct
70 Correct 15 ms 3960 KB Output is correct
71 Correct 13 ms 3968 KB Output is correct
72 Correct 7 ms 3732 KB Output is correct
73 Correct 6 ms 3276 KB Output is correct
74 Correct 7 ms 3716 KB Output is correct
75 Correct 9 ms 3788 KB Output is correct
76 Correct 42 ms 11216 KB Output is correct
77 Correct 33 ms 9408 KB Output is correct
78 Correct 39 ms 10824 KB Output is correct
79 Correct 3 ms 3036 KB Output is correct
80 Correct 4 ms 3020 KB Output is correct
81 Correct 4 ms 3020 KB Output is correct
82 Correct 4 ms 3016 KB Output is correct
83 Correct 4 ms 3020 KB Output is correct
84 Correct 11 ms 4172 KB Output is correct
85 Correct 16 ms 4328 KB Output is correct
86 Correct 13 ms 4200 KB Output is correct
87 Correct 12 ms 4176 KB Output is correct
88 Correct 11 ms 4028 KB Output is correct
89 Correct 12 ms 4172 KB Output is correct
90 Correct 62 ms 13620 KB Output is correct
91 Correct 58 ms 13456 KB Output is correct
92 Correct 59 ms 13540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3020 KB Output is correct
2 Correct 3 ms 3040 KB Output is correct
3 Correct 2 ms 3020 KB Output is correct
4 Correct 3 ms 3020 KB Output is correct
5 Correct 3 ms 3020 KB Output is correct
6 Correct 3 ms 3020 KB Output is correct
7 Correct 3 ms 3020 KB Output is correct
8 Correct 3 ms 3032 KB Output is correct
9 Correct 2 ms 3040 KB Output is correct
10 Correct 3 ms 3020 KB Output is correct
11 Correct 3 ms 3012 KB Output is correct
12 Correct 3 ms 3020 KB Output is correct
13 Correct 3 ms 3020 KB Output is correct
14 Correct 3 ms 3020 KB Output is correct
15 Correct 8 ms 4268 KB Output is correct
16 Correct 9 ms 4436 KB Output is correct
17 Correct 10 ms 4428 KB Output is correct
18 Correct 8 ms 4448 KB Output is correct
19 Correct 8 ms 4428 KB Output is correct
20 Correct 10 ms 4432 KB Output is correct
21 Correct 12 ms 5836 KB Output is correct
22 Correct 13 ms 5708 KB Output is correct
23 Correct 14 ms 5836 KB Output is correct
24 Correct 44 ms 11164 KB Output is correct
25 Correct 47 ms 11108 KB Output is correct
26 Correct 44 ms 11064 KB Output is correct
27 Correct 5 ms 3308 KB Output is correct
28 Correct 6 ms 3308 KB Output is correct
29 Correct 7 ms 3304 KB Output is correct
30 Correct 6 ms 3312 KB Output is correct
31 Correct 7 ms 3276 KB Output is correct
32 Correct 8 ms 3276 KB Output is correct
33 Execution timed out 1586 ms 175444 KB Time limit exceeded
34 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 3020 KB Output is correct
2 Correct 3 ms 3040 KB Output is correct
3 Correct 2 ms 3020 KB Output is correct
4 Correct 3 ms 3020 KB Output is correct
5 Correct 3 ms 3020 KB Output is correct
6 Correct 3 ms 3020 KB Output is correct
7 Correct 3 ms 3020 KB Output is correct
8 Correct 3 ms 3032 KB Output is correct
9 Correct 2 ms 3040 KB Output is correct
10 Correct 3 ms 3020 KB Output is correct
11 Correct 3 ms 3012 KB Output is correct
12 Correct 3 ms 3020 KB Output is correct
13 Correct 3 ms 3020 KB Output is correct
14 Correct 3 ms 3020 KB Output is correct
15 Correct 8 ms 4268 KB Output is correct
16 Correct 9 ms 4436 KB Output is correct
17 Correct 10 ms 4428 KB Output is correct
18 Correct 8 ms 4448 KB Output is correct
19 Correct 8 ms 4428 KB Output is correct
20 Correct 10 ms 4432 KB Output is correct
21 Correct 12 ms 5836 KB Output is correct
22 Correct 13 ms 5708 KB Output is correct
23 Correct 14 ms 5836 KB Output is correct
24 Correct 44 ms 11164 KB Output is correct
25 Correct 47 ms 11108 KB Output is correct
26 Correct 44 ms 11064 KB Output is correct
27 Correct 5 ms 3308 KB Output is correct
28 Correct 6 ms 3308 KB Output is correct
29 Correct 7 ms 3304 KB Output is correct
30 Correct 6 ms 3312 KB Output is correct
31 Correct 7 ms 3276 KB Output is correct
32 Correct 8 ms 3276 KB Output is correct
33 Execution timed out 1586 ms 175444 KB Time limit exceeded
34 Halted 0 ms 0 KB -