# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
293351 | 2020-09-08T00:23:43 Z | daniel920712 | 벽 칠하기 (APIO20_paint) | C++14 | 1500 ms | 260192 KB |
#include "paint.h" #include <vector> #include <stdio.h> using namespace std; bool can[2005][100005]={0}; bool use[2005][100005]={0}; int r[2005][100005]; bool have[200005]={0}; int DP[200005]; vector < int > all; vector < int > how[200005]; int N,M; int F(int here) { int ok=0,ok2,i,j; if(have[here]) return DP[here]; if(here==N) return 0; have[here]=1; if(here+M>N) { DP[here]=1e9; return 1e9; } for(i=0;i<M;i++) if(r[i][here]>=here+M-1) ok=1; DP[here]=1e9; if(ok) for(i=1;i<=M;i++) DP[here]=min(DP[here],F(here+i)+1); return DP[here]; } int F2(int N,int M) { if(N==::N) return N; if(use[M][N]) return r[M][N]; use[M][N]=1; if(can[M][all[N]]==0) r[M][N]=-1e9; else { r[M][N]=max(N,F2(N+1,(M+1)%(::M))); } return r[M][N]; } int minimumInstructions(int N, int M, int K, vector<int> C, vector<int> A,vector< vector<int> > B) { int i,j; all=C; ::N=N; ::M=M; for(i=0;i<M;i++) { for(j=0;j<A[i];j++) { can[i][B[i][j]]=1; how[B[i][j]].push_back(i); } } for(i=0;i<N;i++) { for(j=0;j<M;j++) F2(i,j); } int t=F(0); if(t>=1000000000) return -1; return t; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 4992 KB | Output is correct |
2 | Correct | 3 ms | 4992 KB | Output is correct |
3 | Correct | 3 ms | 4992 KB | Output is correct |
4 | Correct | 3 ms | 4992 KB | Output is correct |
5 | Correct | 3 ms | 4992 KB | Output is correct |
6 | Correct | 3 ms | 4992 KB | Output is correct |
7 | Correct | 3 ms | 5120 KB | Output is correct |
8 | Correct | 3 ms | 5120 KB | Output is correct |
9 | Correct | 3 ms | 4992 KB | Output is correct |
10 | Correct | 3 ms | 5120 KB | Output is correct |
11 | Correct | 3 ms | 5120 KB | Output is correct |
12 | Correct | 3 ms | 5120 KB | Output is correct |
13 | Correct | 10 ms | 9344 KB | Output is correct |
14 | Correct | 10 ms | 9344 KB | Output is correct |
15 | Correct | 12 ms | 9344 KB | Output is correct |
16 | Correct | 10 ms | 9344 KB | Output is correct |
17 | Correct | 10 ms | 9344 KB | Output is correct |
18 | Correct | 10 ms | 9344 KB | Output is correct |
19 | Correct | 12 ms | 10880 KB | Output is correct |
20 | Correct | 11 ms | 11008 KB | Output is correct |
21 | Correct | 11 ms | 11008 KB | Output is correct |
22 | Correct | 46 ms | 30840 KB | Output is correct |
23 | Correct | 46 ms | 30712 KB | Output is correct |
24 | Correct | 46 ms | 30752 KB | Output is correct |
25 | Correct | 7 ms | 6144 KB | Output is correct |
26 | Correct | 7 ms | 6120 KB | Output is correct |
27 | Correct | 7 ms | 5504 KB | Output is correct |
28 | Correct | 7 ms | 5632 KB | Output is correct |
29 | Correct | 7 ms | 5736 KB | Output is correct |
30 | Correct | 7 ms | 5760 KB | Output is correct |
31 | Execution timed out | 1610 ms | 260192 KB | Time limit exceeded |
32 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5120 KB | Output is correct |
2 | Correct | 4 ms | 5120 KB | Output is correct |
3 | Correct | 3 ms | 4992 KB | Output is correct |
4 | Correct | 3 ms | 4992 KB | Output is correct |
5 | Correct | 3 ms | 4992 KB | Output is correct |
6 | Correct | 3 ms | 4992 KB | Output is correct |
7 | Correct | 3 ms | 4992 KB | Output is correct |
8 | Correct | 3 ms | 4992 KB | Output is correct |
9 | Correct | 3 ms | 5120 KB | Output is correct |
10 | Correct | 3 ms | 5120 KB | Output is correct |
11 | Correct | 3 ms | 4992 KB | Output is correct |
12 | Correct | 3 ms | 5120 KB | Output is correct |
13 | Correct | 3 ms | 5120 KB | Output is correct |
14 | Correct | 3 ms | 5120 KB | Output is correct |
15 | Correct | 10 ms | 9344 KB | Output is correct |
16 | Correct | 10 ms | 9344 KB | Output is correct |
17 | Correct | 12 ms | 9344 KB | Output is correct |
18 | Correct | 10 ms | 9344 KB | Output is correct |
19 | Correct | 10 ms | 9344 KB | Output is correct |
20 | Correct | 10 ms | 9344 KB | Output is correct |
21 | Correct | 12 ms | 10880 KB | Output is correct |
22 | Correct | 11 ms | 11008 KB | Output is correct |
23 | Correct | 11 ms | 11008 KB | Output is correct |
24 | Correct | 4 ms | 4992 KB | Output is correct |
25 | Correct | 3 ms | 4992 KB | Output is correct |
26 | Correct | 3 ms | 4992 KB | Output is correct |
27 | Correct | 3 ms | 5120 KB | Output is correct |
28 | Correct | 4 ms | 5376 KB | Output is correct |
29 | Correct | 4 ms | 5504 KB | Output is correct |
30 | Correct | 4 ms | 5504 KB | Output is correct |
31 | Correct | 4 ms | 5120 KB | Output is correct |
32 | Correct | 4 ms | 5760 KB | Output is correct |
33 | Correct | 9 ms | 8448 KB | Output is correct |
34 | Correct | 8 ms | 8576 KB | Output is correct |
35 | Correct | 7 ms | 7424 KB | Output is correct |
36 | Correct | 8 ms | 8192 KB | Output is correct |
37 | Correct | 8 ms | 8320 KB | Output is correct |
38 | Correct | 4 ms | 5504 KB | Output is correct |
39 | Correct | 4 ms | 5120 KB | Output is correct |
40 | Correct | 9 ms | 10112 KB | Output is correct |
41 | Correct | 7 ms | 7424 KB | Output is correct |
42 | Correct | 7 ms | 8320 KB | Output is correct |
43 | Correct | 6 ms | 7040 KB | Output is correct |
44 | Correct | 4 ms | 5120 KB | Output is correct |
45 | Correct | 4 ms | 5504 KB | Output is correct |
46 | Correct | 5 ms | 5632 KB | Output is correct |
47 | Correct | 4 ms | 5760 KB | Output is correct |
48 | Correct | 5 ms | 5888 KB | Output is correct |
49 | Correct | 4 ms | 6016 KB | Output is correct |
50 | Correct | 11 ms | 9344 KB | Output is correct |
51 | Correct | 10 ms | 9344 KB | Output is correct |
52 | Correct | 10 ms | 9344 KB | Output is correct |
53 | Correct | 11 ms | 9344 KB | Output is correct |
54 | Correct | 11 ms | 9344 KB | Output is correct |
55 | Correct | 11 ms | 9344 KB | Output is correct |
56 | Correct | 11 ms | 11008 KB | Output is correct |
57 | Correct | 7 ms | 8192 KB | Output is correct |
58 | Correct | 11 ms | 10880 KB | Output is correct |
59 | Correct | 7 ms | 8192 KB | Output is correct |
60 | Correct | 12 ms | 11008 KB | Output is correct |
61 | Correct | 7 ms | 8192 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5120 KB | Output is correct |
2 | Correct | 4 ms | 5120 KB | Output is correct |
3 | Correct | 3 ms | 4992 KB | Output is correct |
4 | Correct | 3 ms | 4992 KB | Output is correct |
5 | Correct | 3 ms | 4992 KB | Output is correct |
6 | Correct | 3 ms | 4992 KB | Output is correct |
7 | Correct | 3 ms | 4992 KB | Output is correct |
8 | Correct | 3 ms | 4992 KB | Output is correct |
9 | Correct | 3 ms | 5120 KB | Output is correct |
10 | Correct | 3 ms | 5120 KB | Output is correct |
11 | Correct | 3 ms | 4992 KB | Output is correct |
12 | Correct | 3 ms | 5120 KB | Output is correct |
13 | Correct | 3 ms | 5120 KB | Output is correct |
14 | Correct | 3 ms | 5120 KB | Output is correct |
15 | Correct | 10 ms | 9344 KB | Output is correct |
16 | Correct | 10 ms | 9344 KB | Output is correct |
17 | Correct | 12 ms | 9344 KB | Output is correct |
18 | Correct | 10 ms | 9344 KB | Output is correct |
19 | Correct | 10 ms | 9344 KB | Output is correct |
20 | Correct | 10 ms | 9344 KB | Output is correct |
21 | Correct | 12 ms | 10880 KB | Output is correct |
22 | Correct | 11 ms | 11008 KB | Output is correct |
23 | Correct | 11 ms | 11008 KB | Output is correct |
24 | Correct | 46 ms | 30840 KB | Output is correct |
25 | Correct | 46 ms | 30712 KB | Output is correct |
26 | Correct | 46 ms | 30752 KB | Output is correct |
27 | Correct | 4 ms | 4992 KB | Output is correct |
28 | Correct | 3 ms | 4992 KB | Output is correct |
29 | Correct | 3 ms | 4992 KB | Output is correct |
30 | Correct | 3 ms | 5120 KB | Output is correct |
31 | Correct | 4 ms | 5376 KB | Output is correct |
32 | Correct | 4 ms | 5504 KB | Output is correct |
33 | Correct | 4 ms | 5504 KB | Output is correct |
34 | Correct | 4 ms | 5120 KB | Output is correct |
35 | Correct | 4 ms | 5760 KB | Output is correct |
36 | Correct | 9 ms | 8448 KB | Output is correct |
37 | Correct | 8 ms | 8576 KB | Output is correct |
38 | Correct | 7 ms | 7424 KB | Output is correct |
39 | Correct | 8 ms | 8192 KB | Output is correct |
40 | Correct | 8 ms | 8320 KB | Output is correct |
41 | Correct | 4 ms | 5504 KB | Output is correct |
42 | Correct | 4 ms | 5120 KB | Output is correct |
43 | Correct | 9 ms | 10112 KB | Output is correct |
44 | Correct | 7 ms | 7424 KB | Output is correct |
45 | Correct | 7 ms | 8320 KB | Output is correct |
46 | Correct | 6 ms | 7040 KB | Output is correct |
47 | Correct | 4 ms | 5120 KB | Output is correct |
48 | Correct | 4 ms | 5504 KB | Output is correct |
49 | Correct | 5 ms | 5632 KB | Output is correct |
50 | Correct | 4 ms | 5760 KB | Output is correct |
51 | Correct | 5 ms | 5888 KB | Output is correct |
52 | Correct | 4 ms | 6016 KB | Output is correct |
53 | Correct | 11 ms | 9344 KB | Output is correct |
54 | Correct | 10 ms | 9344 KB | Output is correct |
55 | Correct | 10 ms | 9344 KB | Output is correct |
56 | Correct | 11 ms | 9344 KB | Output is correct |
57 | Correct | 11 ms | 9344 KB | Output is correct |
58 | Correct | 11 ms | 9344 KB | Output is correct |
59 | Correct | 11 ms | 11008 KB | Output is correct |
60 | Correct | 7 ms | 8192 KB | Output is correct |
61 | Correct | 11 ms | 10880 KB | Output is correct |
62 | Correct | 7 ms | 8192 KB | Output is correct |
63 | Correct | 12 ms | 11008 KB | Output is correct |
64 | Correct | 7 ms | 8192 KB | Output is correct |
65 | Correct | 6 ms | 7680 KB | Output is correct |
66 | Correct | 4 ms | 5632 KB | Output is correct |
67 | Correct | 6 ms | 6912 KB | Output is correct |
68 | Correct | 5 ms | 6216 KB | Output is correct |
69 | Correct | 1 ms | 6912 KB | Output is correct |
70 | Correct | 18 ms | 21888 KB | Output is correct |
71 | Correct | 15 ms | 17536 KB | Output is correct |
72 | Correct | 10 ms | 10880 KB | Output is correct |
73 | Correct | 6 ms | 6528 KB | Output is correct |
74 | Correct | 12 ms | 14976 KB | Output is correct |
75 | Correct | 18 ms | 22528 KB | Output is correct |
76 | Correct | 41 ms | 17024 KB | Output is correct |
77 | Correct | 28 ms | 8448 KB | Output is correct |
78 | Correct | 42 ms | 12152 KB | Output is correct |
79 | Correct | 8 ms | 8192 KB | Output is correct |
80 | Correct | 8 ms | 8192 KB | Output is correct |
81 | Correct | 8 ms | 8192 KB | Output is correct |
82 | Correct | 8 ms | 8192 KB | Output is correct |
83 | Correct | 8 ms | 8192 KB | Output is correct |
84 | Correct | 22 ms | 25984 KB | Output is correct |
85 | Correct | 21 ms | 25984 KB | Output is correct |
86 | Correct | 22 ms | 26112 KB | Output is correct |
87 | Correct | 22 ms | 26112 KB | Output is correct |
88 | Correct | 22 ms | 26240 KB | Output is correct |
89 | Correct | 21 ms | 25728 KB | Output is correct |
90 | Correct | 71 ms | 30584 KB | Output is correct |
91 | Correct | 67 ms | 30584 KB | Output is correct |
92 | Correct | 64 ms | 30584 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5120 KB | Output is correct |
2 | Correct | 4 ms | 5120 KB | Output is correct |
3 | Correct | 3 ms | 4992 KB | Output is correct |
4 | Correct | 3 ms | 4992 KB | Output is correct |
5 | Correct | 3 ms | 4992 KB | Output is correct |
6 | Correct | 3 ms | 4992 KB | Output is correct |
7 | Correct | 3 ms | 4992 KB | Output is correct |
8 | Correct | 3 ms | 4992 KB | Output is correct |
9 | Correct | 3 ms | 5120 KB | Output is correct |
10 | Correct | 3 ms | 5120 KB | Output is correct |
11 | Correct | 3 ms | 4992 KB | Output is correct |
12 | Correct | 3 ms | 5120 KB | Output is correct |
13 | Correct | 3 ms | 5120 KB | Output is correct |
14 | Correct | 3 ms | 5120 KB | Output is correct |
15 | Correct | 10 ms | 9344 KB | Output is correct |
16 | Correct | 10 ms | 9344 KB | Output is correct |
17 | Correct | 12 ms | 9344 KB | Output is correct |
18 | Correct | 10 ms | 9344 KB | Output is correct |
19 | Correct | 10 ms | 9344 KB | Output is correct |
20 | Correct | 10 ms | 9344 KB | Output is correct |
21 | Correct | 12 ms | 10880 KB | Output is correct |
22 | Correct | 11 ms | 11008 KB | Output is correct |
23 | Correct | 11 ms | 11008 KB | Output is correct |
24 | Correct | 46 ms | 30840 KB | Output is correct |
25 | Correct | 46 ms | 30712 KB | Output is correct |
26 | Correct | 46 ms | 30752 KB | Output is correct |
27 | Correct | 7 ms | 6144 KB | Output is correct |
28 | Correct | 7 ms | 6120 KB | Output is correct |
29 | Correct | 7 ms | 5504 KB | Output is correct |
30 | Correct | 7 ms | 5632 KB | Output is correct |
31 | Correct | 7 ms | 5736 KB | Output is correct |
32 | Correct | 7 ms | 5760 KB | Output is correct |
33 | Execution timed out | 1610 ms | 260192 KB | Time limit exceeded |
34 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 5120 KB | Output is correct |
2 | Correct | 4 ms | 5120 KB | Output is correct |
3 | Correct | 3 ms | 4992 KB | Output is correct |
4 | Correct | 3 ms | 4992 KB | Output is correct |
5 | Correct | 3 ms | 4992 KB | Output is correct |
6 | Correct | 3 ms | 4992 KB | Output is correct |
7 | Correct | 3 ms | 4992 KB | Output is correct |
8 | Correct | 3 ms | 4992 KB | Output is correct |
9 | Correct | 3 ms | 5120 KB | Output is correct |
10 | Correct | 3 ms | 5120 KB | Output is correct |
11 | Correct | 3 ms | 4992 KB | Output is correct |
12 | Correct | 3 ms | 5120 KB | Output is correct |
13 | Correct | 3 ms | 5120 KB | Output is correct |
14 | Correct | 3 ms | 5120 KB | Output is correct |
15 | Correct | 10 ms | 9344 KB | Output is correct |
16 | Correct | 10 ms | 9344 KB | Output is correct |
17 | Correct | 12 ms | 9344 KB | Output is correct |
18 | Correct | 10 ms | 9344 KB | Output is correct |
19 | Correct | 10 ms | 9344 KB | Output is correct |
20 | Correct | 10 ms | 9344 KB | Output is correct |
21 | Correct | 12 ms | 10880 KB | Output is correct |
22 | Correct | 11 ms | 11008 KB | Output is correct |
23 | Correct | 11 ms | 11008 KB | Output is correct |
24 | Correct | 46 ms | 30840 KB | Output is correct |
25 | Correct | 46 ms | 30712 KB | Output is correct |
26 | Correct | 46 ms | 30752 KB | Output is correct |
27 | Correct | 7 ms | 6144 KB | Output is correct |
28 | Correct | 7 ms | 6120 KB | Output is correct |
29 | Correct | 7 ms | 5504 KB | Output is correct |
30 | Correct | 7 ms | 5632 KB | Output is correct |
31 | Correct | 7 ms | 5736 KB | Output is correct |
32 | Correct | 7 ms | 5760 KB | Output is correct |
33 | Execution timed out | 1610 ms | 260192 KB | Time limit exceeded |
34 | Halted | 0 ms | 0 KB | - |