답안 #934299

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
934299 2024-02-27T06:35:06 Z irmuun 벽 칠하기 (APIO20_paint) C++17
51 / 100
239 ms 524288 KB
#include<bits/stdc++.h>
 
using namespace std;
 
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define all(s) s.begin(),s.end()
#define rall(s) s.rbegin(),s.rend()
 
int minimumInstructions(int n,int m,int k,vector<int>C,vector<int>A,vector<vector<int>>B){
    vector<vector<int>>q(n,vector<int>(m));
    vector<vector<bool>>have(k,vector<bool>(m,0));
    for(int i=0;i<m;i++){
        for(auto x:B[i]){
            have[x][i]=true;
        }
    }
    for(int i=n-1;i>=0;i--){
        for(int j=0;j<m;j++){
            if(have[C[i]][j]==false){
                q[i][j]=-1e9;
            }
            else if(i==n-1||have[C[i+1]][(j+1)%m]==false){
                q[i][j]=1;
            }
            else{
                q[i][j]=q[i+1][(j+1)%m]+1;
            }
        }
    }
    vector<int>mn(n+1,1e9);
    mn[n]=0;
    multiset<int>st;
    for(int i=n-m+1;i<=n;i++){
        st.insert(mn[i]);
    }
    for(int i=n-m;i>=0;i--){
        bool ok=false;
        for(int j=0;j<m;j++){
            if(q[i][j]>=m){
                ok=true;
                break;
            }
        }
        if(ok){
            mn[i]=*st.begin()+1;
        }
        st.erase(st.find(mn[i+m]));
        st.insert(mn[i]);
    }
    if(mn[0]>=1e9) return -1;
    return mn[0];
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 1 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 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 8 ms 9560 KB Output is correct
14 Correct 8 ms 9340 KB Output is correct
15 Correct 8 ms 9308 KB Output is correct
16 Correct 8 ms 9308 KB Output is correct
17 Correct 9 ms 9304 KB Output is correct
18 Correct 8 ms 9308 KB Output is correct
19 Correct 9 ms 9304 KB Output is correct
20 Correct 9 ms 9304 KB Output is correct
21 Correct 9 ms 9348 KB Output is correct
22 Correct 16 ms 10844 KB Output is correct
23 Correct 15 ms 10844 KB Output is correct
24 Correct 15 ms 10844 KB Output is correct
25 Correct 4 ms 1628 KB Output is correct
26 Correct 3 ms 1624 KB Output is correct
27 Correct 4 ms 1628 KB Output is correct
28 Correct 4 ms 1628 KB Output is correct
29 Correct 4 ms 1628 KB Output is correct
30 Correct 4 ms 1684 KB Output is correct
31 Correct 148 ms 189144 KB Output is correct
32 Correct 136 ms 189264 KB Output is correct
33 Correct 132 ms 189008 KB Output is correct
34 Correct 135 ms 188972 KB Output is correct
35 Correct 138 ms 189124 KB Output is correct
36 Correct 136 ms 189188 KB Output is correct
37 Correct 147 ms 190036 KB Output is correct
38 Correct 149 ms 190268 KB Output is correct
39 Correct 150 ms 190032 KB Output is correct
40 Correct 14 ms 6612 KB Output is correct
41 Correct 9 ms 4188 KB Output is correct
42 Correct 17 ms 7000 KB Output is correct
43 Correct 16 ms 4696 KB Output is correct
44 Correct 11 ms 4444 KB Output is correct
45 Correct 18 ms 7260 KB Output is correct
46 Runtime error 239 ms 524288 KB Execution killed with signal 9
47 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 1 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 1 ms 344 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 8 ms 9560 KB Output is correct
14 Correct 8 ms 9340 KB Output is correct
15 Correct 8 ms 9308 KB Output is correct
16 Correct 8 ms 9308 KB Output is correct
17 Correct 9 ms 9304 KB Output is correct
18 Correct 8 ms 9308 KB Output is correct
19 Correct 9 ms 9304 KB Output is correct
20 Correct 9 ms 9304 KB Output is correct
21 Correct 9 ms 9348 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 1 ms 600 KB Output is correct
31 Correct 1 ms 344 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 8 ms 6748 KB Output is correct
34 Correct 7 ms 5212 KB Output is correct
35 Correct 4 ms 4444 KB Output is correct
36 Correct 9 ms 7516 KB Output is correct
37 Correct 9 ms 6236 KB Output is correct
38 Correct 6 ms 6644 KB Output is correct
39 Correct 1 ms 348 KB Output is correct
40 Correct 7 ms 5792 KB Output is correct
41 Correct 1 ms 604 KB Output is correct
42 Correct 10 ms 7260 KB Output is correct
43 Correct 10 ms 6824 KB Output is correct
44 Correct 0 ms 344 KB Output is correct
45 Correct 1 ms 348 KB Output is correct
46 Correct 1 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 8 ms 9292 KB Output is correct
51 Correct 9 ms 9380 KB Output is correct
52 Correct 8 ms 9304 KB Output is correct
53 Correct 9 ms 9404 KB Output is correct
54 Correct 8 ms 9308 KB Output is correct
55 Correct 9 ms 9308 KB Output is correct
56 Correct 8 ms 9404 KB Output is correct
57 Correct 1 ms 860 KB Output is correct
58 Correct 8 ms 9308 KB Output is correct
59 Correct 1 ms 860 KB Output is correct
60 Correct 8 ms 9308 KB Output is correct
61 Correct 1 ms 860 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 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 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 8 ms 9560 KB Output is correct
16 Correct 8 ms 9340 KB Output is correct
17 Correct 8 ms 9308 KB Output is correct
18 Correct 8 ms 9308 KB Output is correct
19 Correct 9 ms 9304 KB Output is correct
20 Correct 8 ms 9308 KB Output is correct
21 Correct 9 ms 9304 KB Output is correct
22 Correct 9 ms 9304 KB Output is correct
23 Correct 9 ms 9348 KB Output is correct
24 Correct 16 ms 10844 KB Output is correct
25 Correct 15 ms 10844 KB Output is correct
26 Correct 15 ms 10844 KB Output is correct
27 Correct 0 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
29 Correct 1 ms 348 KB Output is correct
30 Correct 0 ms 348 KB Output is correct
31 Correct 0 ms 348 KB Output is correct
32 Correct 1 ms 348 KB Output is correct
33 Correct 1 ms 600 KB Output is correct
34 Correct 1 ms 344 KB Output is correct
35 Correct 1 ms 348 KB Output is correct
36 Correct 8 ms 6748 KB Output is correct
37 Correct 7 ms 5212 KB Output is correct
38 Correct 4 ms 4444 KB Output is correct
39 Correct 9 ms 7516 KB Output is correct
40 Correct 9 ms 6236 KB Output is correct
41 Correct 6 ms 6644 KB Output is correct
42 Correct 1 ms 348 KB Output is correct
43 Correct 7 ms 5792 KB Output is correct
44 Correct 1 ms 604 KB Output is correct
45 Correct 10 ms 7260 KB Output is correct
46 Correct 10 ms 6824 KB Output is correct
47 Correct 0 ms 344 KB Output is correct
48 Correct 1 ms 348 KB Output is correct
49 Correct 1 ms 348 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 1 ms 348 KB Output is correct
52 Correct 1 ms 348 KB Output is correct
53 Correct 8 ms 9292 KB Output is correct
54 Correct 9 ms 9380 KB Output is correct
55 Correct 8 ms 9304 KB Output is correct
56 Correct 9 ms 9404 KB Output is correct
57 Correct 8 ms 9308 KB Output is correct
58 Correct 9 ms 9308 KB Output is correct
59 Correct 8 ms 9404 KB Output is correct
60 Correct 1 ms 860 KB Output is correct
61 Correct 8 ms 9308 KB Output is correct
62 Correct 1 ms 860 KB Output is correct
63 Correct 8 ms 9308 KB Output is correct
64 Correct 1 ms 860 KB Output is correct
65 Correct 1 ms 600 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 604 KB Output is correct
68 Correct 1 ms 604 KB Output is correct
69 Correct 1 ms 604 KB Output is correct
70 Correct 11 ms 6912 KB Output is correct
71 Correct 8 ms 5564 KB Output is correct
72 Correct 7 ms 4956 KB Output is correct
73 Correct 6 ms 5468 KB Output is correct
74 Correct 9 ms 6488 KB Output is correct
75 Correct 13 ms 7764 KB Output is correct
76 Correct 16 ms 7004 KB Output is correct
77 Correct 14 ms 8024 KB Output is correct
78 Correct 20 ms 9048 KB Output is correct
79 Correct 1 ms 860 KB Output is correct
80 Correct 1 ms 856 KB Output is correct
81 Correct 1 ms 860 KB Output is correct
82 Correct 1 ms 860 KB Output is correct
83 Correct 1 ms 860 KB Output is correct
84 Correct 12 ms 9572 KB Output is correct
85 Correct 11 ms 9564 KB Output is correct
86 Correct 10 ms 9564 KB Output is correct
87 Correct 14 ms 9692 KB Output is correct
88 Correct 9 ms 9564 KB Output is correct
89 Correct 9 ms 9564 KB Output is correct
90 Correct 20 ms 11580 KB Output is correct
91 Correct 20 ms 11452 KB Output is correct
92 Correct 20 ms 11612 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 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 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 8 ms 9560 KB Output is correct
16 Correct 8 ms 9340 KB Output is correct
17 Correct 8 ms 9308 KB Output is correct
18 Correct 8 ms 9308 KB Output is correct
19 Correct 9 ms 9304 KB Output is correct
20 Correct 8 ms 9308 KB Output is correct
21 Correct 9 ms 9304 KB Output is correct
22 Correct 9 ms 9304 KB Output is correct
23 Correct 9 ms 9348 KB Output is correct
24 Correct 16 ms 10844 KB Output is correct
25 Correct 15 ms 10844 KB Output is correct
26 Correct 15 ms 10844 KB Output is correct
27 Correct 4 ms 1628 KB Output is correct
28 Correct 3 ms 1624 KB Output is correct
29 Correct 4 ms 1628 KB Output is correct
30 Correct 4 ms 1628 KB Output is correct
31 Correct 4 ms 1628 KB Output is correct
32 Correct 4 ms 1684 KB Output is correct
33 Correct 148 ms 189144 KB Output is correct
34 Correct 136 ms 189264 KB Output is correct
35 Correct 132 ms 189008 KB Output is correct
36 Correct 135 ms 188972 KB Output is correct
37 Correct 138 ms 189124 KB Output is correct
38 Correct 136 ms 189188 KB Output is correct
39 Correct 147 ms 190036 KB Output is correct
40 Correct 149 ms 190268 KB Output is correct
41 Correct 150 ms 190032 KB Output is correct
42 Correct 0 ms 348 KB Output is correct
43 Correct 0 ms 348 KB Output is correct
44 Correct 1 ms 348 KB Output is correct
45 Correct 0 ms 348 KB Output is correct
46 Correct 0 ms 348 KB Output is correct
47 Correct 1 ms 348 KB Output is correct
48 Correct 1 ms 600 KB Output is correct
49 Correct 1 ms 344 KB Output is correct
50 Correct 1 ms 348 KB Output is correct
51 Correct 8 ms 6748 KB Output is correct
52 Correct 7 ms 5212 KB Output is correct
53 Correct 4 ms 4444 KB Output is correct
54 Correct 9 ms 7516 KB Output is correct
55 Correct 9 ms 6236 KB Output is correct
56 Correct 6 ms 6644 KB Output is correct
57 Correct 1 ms 348 KB Output is correct
58 Correct 7 ms 5792 KB Output is correct
59 Correct 1 ms 604 KB Output is correct
60 Correct 10 ms 7260 KB Output is correct
61 Correct 10 ms 6824 KB Output is correct
62 Correct 0 ms 344 KB Output is correct
63 Correct 1 ms 348 KB Output is correct
64 Correct 1 ms 348 KB Output is correct
65 Correct 1 ms 348 KB Output is correct
66 Correct 1 ms 348 KB Output is correct
67 Correct 1 ms 348 KB Output is correct
68 Correct 8 ms 9292 KB Output is correct
69 Correct 9 ms 9380 KB Output is correct
70 Correct 8 ms 9304 KB Output is correct
71 Correct 9 ms 9404 KB Output is correct
72 Correct 8 ms 9308 KB Output is correct
73 Correct 9 ms 9308 KB Output is correct
74 Correct 8 ms 9404 KB Output is correct
75 Correct 1 ms 860 KB Output is correct
76 Correct 8 ms 9308 KB Output is correct
77 Correct 1 ms 860 KB Output is correct
78 Correct 8 ms 9308 KB Output is correct
79 Correct 1 ms 860 KB Output is correct
80 Correct 1 ms 600 KB Output is correct
81 Correct 1 ms 348 KB Output is correct
82 Correct 1 ms 604 KB Output is correct
83 Correct 1 ms 604 KB Output is correct
84 Correct 1 ms 604 KB Output is correct
85 Correct 11 ms 6912 KB Output is correct
86 Correct 8 ms 5564 KB Output is correct
87 Correct 7 ms 4956 KB Output is correct
88 Correct 6 ms 5468 KB Output is correct
89 Correct 9 ms 6488 KB Output is correct
90 Correct 13 ms 7764 KB Output is correct
91 Correct 16 ms 7004 KB Output is correct
92 Correct 14 ms 8024 KB Output is correct
93 Correct 20 ms 9048 KB Output is correct
94 Correct 1 ms 860 KB Output is correct
95 Correct 1 ms 856 KB Output is correct
96 Correct 1 ms 860 KB Output is correct
97 Correct 1 ms 860 KB Output is correct
98 Correct 1 ms 860 KB Output is correct
99 Correct 12 ms 9572 KB Output is correct
100 Correct 11 ms 9564 KB Output is correct
101 Correct 10 ms 9564 KB Output is correct
102 Correct 14 ms 9692 KB Output is correct
103 Correct 9 ms 9564 KB Output is correct
104 Correct 9 ms 9564 KB Output is correct
105 Correct 20 ms 11580 KB Output is correct
106 Correct 20 ms 11452 KB Output is correct
107 Correct 20 ms 11612 KB Output is correct
108 Correct 4 ms 1624 KB Output is correct
109 Correct 61 ms 36184 KB Output is correct
110 Correct 45 ms 32096 KB Output is correct
111 Correct 41 ms 31576 KB Output is correct
112 Correct 54 ms 45136 KB Output is correct
113 Correct 60 ms 41048 KB Output is correct
114 Correct 58 ms 62548 KB Output is correct
115 Correct 16 ms 10584 KB Output is correct
116 Correct 67 ms 68180 KB Output is correct
117 Correct 44 ms 40540 KB Output is correct
118 Correct 20 ms 12892 KB Output is correct
119 Correct 86 ms 109140 KB Output is correct
120 Correct 94 ms 111588 KB Output is correct
121 Correct 73 ms 95536 KB Output is correct
122 Correct 46 ms 34636 KB Output is correct
123 Correct 28 ms 27740 KB Output is correct
124 Correct 35 ms 20060 KB Output is correct
125 Correct 21 ms 14424 KB Output is correct
126 Correct 13 ms 6492 KB Output is correct
127 Correct 54 ms 49960 KB Output is correct
128 Correct 18 ms 13656 KB Output is correct
129 Correct 28 ms 15812 KB Output is correct
130 Correct 4 ms 1628 KB Output is correct
131 Correct 80 ms 50976 KB Output is correct
132 Correct 87 ms 64120 KB Output is correct
133 Correct 82 ms 72268 KB Output is correct
134 Correct 103 ms 79048 KB Output is correct
135 Correct 125 ms 84936 KB Output is correct
136 Correct 148 ms 189780 KB Output is correct
137 Correct 146 ms 189864 KB Output is correct
138 Correct 151 ms 190036 KB Output is correct
139 Correct 167 ms 189876 KB Output is correct
140 Correct 147 ms 189860 KB Output is correct
141 Correct 144 ms 189780 KB Output is correct
142 Correct 160 ms 191036 KB Output is correct
143 Correct 141 ms 164620 KB Output is correct
144 Correct 159 ms 190804 KB Output is correct
145 Correct 133 ms 164740 KB Output is correct
146 Correct 159 ms 190800 KB Output is correct
147 Correct 125 ms 164692 KB Output is correct
148 Correct 165 ms 189276 KB Output is correct
149 Correct 91 ms 98360 KB Output is correct
150 Correct 68 ms 67228 KB Output is correct
151 Correct 63 ms 52816 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 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 1 ms 348 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 8 ms 9560 KB Output is correct
16 Correct 8 ms 9340 KB Output is correct
17 Correct 8 ms 9308 KB Output is correct
18 Correct 8 ms 9308 KB Output is correct
19 Correct 9 ms 9304 KB Output is correct
20 Correct 8 ms 9308 KB Output is correct
21 Correct 9 ms 9304 KB Output is correct
22 Correct 9 ms 9304 KB Output is correct
23 Correct 9 ms 9348 KB Output is correct
24 Correct 16 ms 10844 KB Output is correct
25 Correct 15 ms 10844 KB Output is correct
26 Correct 15 ms 10844 KB Output is correct
27 Correct 4 ms 1628 KB Output is correct
28 Correct 3 ms 1624 KB Output is correct
29 Correct 4 ms 1628 KB Output is correct
30 Correct 4 ms 1628 KB Output is correct
31 Correct 4 ms 1628 KB Output is correct
32 Correct 4 ms 1684 KB Output is correct
33 Correct 148 ms 189144 KB Output is correct
34 Correct 136 ms 189264 KB Output is correct
35 Correct 132 ms 189008 KB Output is correct
36 Correct 135 ms 188972 KB Output is correct
37 Correct 138 ms 189124 KB Output is correct
38 Correct 136 ms 189188 KB Output is correct
39 Correct 147 ms 190036 KB Output is correct
40 Correct 149 ms 190268 KB Output is correct
41 Correct 150 ms 190032 KB Output is correct
42 Correct 14 ms 6612 KB Output is correct
43 Correct 9 ms 4188 KB Output is correct
44 Correct 17 ms 7000 KB Output is correct
45 Correct 16 ms 4696 KB Output is correct
46 Correct 11 ms 4444 KB Output is correct
47 Correct 18 ms 7260 KB Output is correct
48 Runtime error 239 ms 524288 KB Execution killed with signal 9
49 Halted 0 ms 0 KB -