#include <bits/stdc++.h>
#include "paint.h"
using namespace std;
vector <vector <int>> likers;
vector <int> pos;
vector <vector <int>> spreadLeft;
deque <int> dq;
vector <int> dp;
/**
8 3 5
3 3 1 3 4 4 2 2
3 0 1 2
2 2 3
2 3 4
*/
int minimumInstructions(int N,int M,int K,vector <int> C,vector <int> A,vector <vector <int>> B)
{
likers.resize(K);
for(int i=0; i<M; i++)
for(auto it:B[i])
likers[it].push_back(i);
pos.resize(M);
for(int i=0; i<M; i++)
pos[i]=-1;
dp.resize(N);
spreadLeft.resize(N);
for(int i=0; i<N; i++)
{
spreadLeft[i].resize(likers[C[i]].size());
int maxim;
if(i>0)
{
maxim=0;
for(int j=0; j<(int)likers[C[i]].size(); j++)
{
int pj=pos[(likers[C[i]][j]-1+M)%M];
if(pj==-1)
spreadLeft[i][j]=1;
else
spreadLeft[i][j]=spreadLeft[i-1][pj]+1;
maxim=max(maxim,spreadLeft[i][j]);
}
}
else
{
maxim=1;
for(int j=0; j<(int)likers[C[i]].size(); j++)
spreadLeft[i][j]=1;
}
if(i>0)
{
for(int j=0; j<(int)likers[C[i-1]].size(); j++)
pos[likers[C[i-1]][j]]=-1;
}
for(int j=0; j<(int)likers[C[i]].size(); j++)
pos[likers[C[i]][j]]=j;
if(i<M-1)
dp[i]=N+1;
else if(i==M-1)
{
if(maxim<M)
return -1;
dp[i]=1;
}
else
{
while(!dq.empty() && dq.front()<i-M)
dq.pop_front();
if(maxim>=M)
dp[i]=min(N+1,dp[dq.front()]+1);
else
dp[i]=N+1;
}
while(!dq.empty() && dp[dq.back()]>=dp[i])
dq.pop_back();
dq.push_back(i);
}
if(dp[N-1]==N+1)
return -1;
return dp[N-1];
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
300 KB |
Output is correct |
6 |
Correct |
1 ms |
296 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
2608 KB |
Output is correct |
14 |
Correct |
1 ms |
2644 KB |
Output is correct |
15 |
Correct |
2 ms |
2644 KB |
Output is correct |
16 |
Correct |
1 ms |
2644 KB |
Output is correct |
17 |
Correct |
1 ms |
2644 KB |
Output is correct |
18 |
Correct |
2 ms |
2644 KB |
Output is correct |
19 |
Correct |
2 ms |
2736 KB |
Output is correct |
20 |
Correct |
1 ms |
2644 KB |
Output is correct |
21 |
Correct |
1 ms |
2644 KB |
Output is correct |
22 |
Correct |
18 ms |
7156 KB |
Output is correct |
23 |
Correct |
13 ms |
7124 KB |
Output is correct |
24 |
Correct |
13 ms |
7120 KB |
Output is correct |
25 |
Correct |
3 ms |
1620 KB |
Output is correct |
26 |
Correct |
3 ms |
1620 KB |
Output is correct |
27 |
Correct |
2 ms |
960 KB |
Output is correct |
28 |
Correct |
2 ms |
928 KB |
Output is correct |
29 |
Correct |
2 ms |
948 KB |
Output is correct |
30 |
Correct |
2 ms |
980 KB |
Output is correct |
31 |
Correct |
8 ms |
5076 KB |
Output is correct |
32 |
Correct |
8 ms |
5076 KB |
Output is correct |
33 |
Correct |
7 ms |
5076 KB |
Output is correct |
34 |
Correct |
8 ms |
5092 KB |
Output is correct |
35 |
Correct |
8 ms |
5148 KB |
Output is correct |
36 |
Correct |
8 ms |
5096 KB |
Output is correct |
37 |
Correct |
18 ms |
8164 KB |
Output is correct |
38 |
Correct |
19 ms |
8144 KB |
Output is correct |
39 |
Correct |
15 ms |
8172 KB |
Output is correct |
40 |
Correct |
12 ms |
6504 KB |
Output is correct |
41 |
Correct |
11 ms |
4148 KB |
Output is correct |
42 |
Correct |
15 ms |
6996 KB |
Output is correct |
43 |
Correct |
5 ms |
2644 KB |
Output is correct |
44 |
Correct |
7 ms |
2516 KB |
Output is correct |
45 |
Correct |
8 ms |
3964 KB |
Output is correct |
46 |
Correct |
36 ms |
18004 KB |
Output is correct |
47 |
Correct |
22 ms |
11468 KB |
Output is correct |
48 |
Correct |
25 ms |
13952 KB |
Output is correct |
49 |
Correct |
29 ms |
13824 KB |
Output is correct |
50 |
Correct |
30 ms |
13624 KB |
Output is correct |
51 |
Correct |
22 ms |
10604 KB |
Output is correct |
52 |
Correct |
14 ms |
7140 KB |
Output is correct |
53 |
Correct |
17 ms |
7124 KB |
Output is correct |
54 |
Correct |
14 ms |
7096 KB |
Output is correct |
55 |
Correct |
8 ms |
3972 KB |
Output is correct |
56 |
Correct |
8 ms |
4032 KB |
Output is correct |
57 |
Correct |
7 ms |
3924 KB |
Output is correct |
58 |
Correct |
39 ms |
19624 KB |
Output is correct |
59 |
Correct |
41 ms |
19716 KB |
Output is correct |
60 |
Correct |
40 ms |
19696 KB |
Output is correct |
61 |
Correct |
41 ms |
19660 KB |
Output is correct |
62 |
Correct |
40 ms |
19624 KB |
Output is correct |
63 |
Correct |
52 ms |
19648 KB |
Output is correct |
64 |
Correct |
37 ms |
17100 KB |
Output is correct |
65 |
Correct |
44 ms |
17192 KB |
Output is correct |
66 |
Correct |
50 ms |
17100 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
300 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
300 KB |
Output is correct |
6 |
Correct |
1 ms |
296 KB |
Output is correct |
7 |
Correct |
1 ms |
212 KB |
Output is correct |
8 |
Correct |
1 ms |
340 KB |
Output is correct |
9 |
Correct |
1 ms |
340 KB |
Output is correct |
10 |
Correct |
1 ms |
212 KB |
Output is correct |
11 |
Correct |
1 ms |
212 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
2608 KB |
Output is correct |
14 |
Correct |
1 ms |
2644 KB |
Output is correct |
15 |
Correct |
2 ms |
2644 KB |
Output is correct |
16 |
Correct |
1 ms |
2644 KB |
Output is correct |
17 |
Correct |
1 ms |
2644 KB |
Output is correct |
18 |
Correct |
2 ms |
2644 KB |
Output is correct |
19 |
Correct |
2 ms |
2736 KB |
Output is correct |
20 |
Correct |
1 ms |
2644 KB |
Output is correct |
21 |
Correct |
1 ms |
2644 KB |
Output is correct |
22 |
Correct |
0 ms |
212 KB |
Output is correct |
23 |
Correct |
0 ms |
212 KB |
Output is correct |
24 |
Correct |
0 ms |
212 KB |
Output is correct |
25 |
Correct |
0 ms |
212 KB |
Output is correct |
26 |
Correct |
1 ms |
296 KB |
Output is correct |
27 |
Correct |
1 ms |
212 KB |
Output is correct |
28 |
Correct |
1 ms |
296 KB |
Output is correct |
29 |
Correct |
1 ms |
212 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
340 KB |
Output is correct |
32 |
Correct |
1 ms |
304 KB |
Output is correct |
33 |
Correct |
1 ms |
2260 KB |
Output is correct |
34 |
Correct |
1 ms |
1748 KB |
Output is correct |
35 |
Correct |
1 ms |
1620 KB |
Output is correct |
36 |
Correct |
2 ms |
2644 KB |
Output is correct |
37 |
Correct |
1 ms |
2228 KB |
Output is correct |
38 |
Correct |
1 ms |
2388 KB |
Output is correct |
39 |
Correct |
1 ms |
340 KB |
Output is correct |
40 |
Correct |
1 ms |
2132 KB |
Output is correct |
41 |
Correct |
1 ms |
288 KB |
Output is correct |
42 |
Correct |
1 ms |
2516 KB |
Output is correct |
43 |
Correct |
1 ms |
2516 KB |
Output is correct |
44 |
Correct |
1 ms |
340 KB |
Output is correct |
45 |
Correct |
1 ms |
340 KB |
Output is correct |
46 |
Correct |
1 ms |
212 KB |
Output is correct |
47 |
Correct |
1 ms |
212 KB |
Output is correct |
48 |
Correct |
1 ms |
212 KB |
Output is correct |
49 |
Correct |
1 ms |
212 KB |
Output is correct |
50 |
Correct |
1 ms |
2644 KB |
Output is correct |
51 |
Correct |
2 ms |
2644 KB |
Output is correct |
52 |
Correct |
2 ms |
2704 KB |
Output is correct |
53 |
Correct |
1 ms |
2732 KB |
Output is correct |
54 |
Correct |
2 ms |
2644 KB |
Output is correct |
55 |
Correct |
1 ms |
2608 KB |
Output is correct |
56 |
Correct |
1 ms |
2644 KB |
Output is correct |
57 |
Correct |
1 ms |
340 KB |
Output is correct |
58 |
Correct |
2 ms |
2644 KB |
Output is correct |
59 |
Correct |
1 ms |
340 KB |
Output is correct |
60 |
Correct |
2 ms |
2644 KB |
Output is correct |
61 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
300 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
296 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
2608 KB |
Output is correct |
16 |
Correct |
1 ms |
2644 KB |
Output is correct |
17 |
Correct |
2 ms |
2644 KB |
Output is correct |
18 |
Correct |
1 ms |
2644 KB |
Output is correct |
19 |
Correct |
1 ms |
2644 KB |
Output is correct |
20 |
Correct |
2 ms |
2644 KB |
Output is correct |
21 |
Correct |
2 ms |
2736 KB |
Output is correct |
22 |
Correct |
1 ms |
2644 KB |
Output is correct |
23 |
Correct |
1 ms |
2644 KB |
Output is correct |
24 |
Correct |
18 ms |
7156 KB |
Output is correct |
25 |
Correct |
13 ms |
7124 KB |
Output is correct |
26 |
Correct |
13 ms |
7120 KB |
Output is correct |
27 |
Correct |
0 ms |
212 KB |
Output is correct |
28 |
Correct |
0 ms |
212 KB |
Output is correct |
29 |
Correct |
1 ms |
296 KB |
Output is correct |
30 |
Correct |
1 ms |
212 KB |
Output is correct |
31 |
Correct |
1 ms |
296 KB |
Output is correct |
32 |
Correct |
1 ms |
212 KB |
Output is correct |
33 |
Correct |
1 ms |
212 KB |
Output is correct |
34 |
Correct |
1 ms |
340 KB |
Output is correct |
35 |
Correct |
1 ms |
304 KB |
Output is correct |
36 |
Correct |
1 ms |
2260 KB |
Output is correct |
37 |
Correct |
1 ms |
1748 KB |
Output is correct |
38 |
Correct |
1 ms |
1620 KB |
Output is correct |
39 |
Correct |
2 ms |
2644 KB |
Output is correct |
40 |
Correct |
1 ms |
2228 KB |
Output is correct |
41 |
Correct |
1 ms |
2388 KB |
Output is correct |
42 |
Correct |
1 ms |
340 KB |
Output is correct |
43 |
Correct |
1 ms |
2132 KB |
Output is correct |
44 |
Correct |
1 ms |
288 KB |
Output is correct |
45 |
Correct |
1 ms |
2516 KB |
Output is correct |
46 |
Correct |
1 ms |
2516 KB |
Output is correct |
47 |
Correct |
1 ms |
340 KB |
Output is correct |
48 |
Correct |
1 ms |
340 KB |
Output is correct |
49 |
Correct |
1 ms |
212 KB |
Output is correct |
50 |
Correct |
1 ms |
212 KB |
Output is correct |
51 |
Correct |
1 ms |
212 KB |
Output is correct |
52 |
Correct |
1 ms |
212 KB |
Output is correct |
53 |
Correct |
1 ms |
2644 KB |
Output is correct |
54 |
Correct |
2 ms |
2644 KB |
Output is correct |
55 |
Correct |
2 ms |
2704 KB |
Output is correct |
56 |
Correct |
1 ms |
2732 KB |
Output is correct |
57 |
Correct |
2 ms |
2644 KB |
Output is correct |
58 |
Correct |
1 ms |
2608 KB |
Output is correct |
59 |
Correct |
1 ms |
2644 KB |
Output is correct |
60 |
Correct |
1 ms |
340 KB |
Output is correct |
61 |
Correct |
2 ms |
2644 KB |
Output is correct |
62 |
Correct |
1 ms |
340 KB |
Output is correct |
63 |
Correct |
2 ms |
2644 KB |
Output is correct |
64 |
Correct |
1 ms |
340 KB |
Output is correct |
65 |
Correct |
1 ms |
468 KB |
Output is correct |
66 |
Correct |
1 ms |
304 KB |
Output is correct |
67 |
Correct |
1 ms |
552 KB |
Output is correct |
68 |
Correct |
1 ms |
468 KB |
Output is correct |
69 |
Correct |
1 ms |
468 KB |
Output is correct |
70 |
Correct |
2 ms |
2552 KB |
Output is correct |
71 |
Correct |
2 ms |
2132 KB |
Output is correct |
72 |
Correct |
2 ms |
2004 KB |
Output is correct |
73 |
Correct |
2 ms |
2004 KB |
Output is correct |
74 |
Correct |
2 ms |
2388 KB |
Output is correct |
75 |
Correct |
2 ms |
2772 KB |
Output is correct |
76 |
Correct |
14 ms |
5176 KB |
Output is correct |
77 |
Correct |
14 ms |
6068 KB |
Output is correct |
78 |
Correct |
18 ms |
6892 KB |
Output is correct |
79 |
Correct |
1 ms |
680 KB |
Output is correct |
80 |
Correct |
2 ms |
724 KB |
Output is correct |
81 |
Correct |
2 ms |
724 KB |
Output is correct |
82 |
Correct |
2 ms |
724 KB |
Output is correct |
83 |
Correct |
2 ms |
724 KB |
Output is correct |
84 |
Correct |
3 ms |
2996 KB |
Output is correct |
85 |
Correct |
3 ms |
2996 KB |
Output is correct |
86 |
Correct |
3 ms |
3004 KB |
Output is correct |
87 |
Correct |
3 ms |
2900 KB |
Output is correct |
88 |
Correct |
3 ms |
2900 KB |
Output is correct |
89 |
Correct |
3 ms |
2900 KB |
Output is correct |
90 |
Correct |
19 ms |
7228 KB |
Output is correct |
91 |
Correct |
20 ms |
7248 KB |
Output is correct |
92 |
Correct |
19 ms |
7244 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
300 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
296 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
2608 KB |
Output is correct |
16 |
Correct |
1 ms |
2644 KB |
Output is correct |
17 |
Correct |
2 ms |
2644 KB |
Output is correct |
18 |
Correct |
1 ms |
2644 KB |
Output is correct |
19 |
Correct |
1 ms |
2644 KB |
Output is correct |
20 |
Correct |
2 ms |
2644 KB |
Output is correct |
21 |
Correct |
2 ms |
2736 KB |
Output is correct |
22 |
Correct |
1 ms |
2644 KB |
Output is correct |
23 |
Correct |
1 ms |
2644 KB |
Output is correct |
24 |
Correct |
18 ms |
7156 KB |
Output is correct |
25 |
Correct |
13 ms |
7124 KB |
Output is correct |
26 |
Correct |
13 ms |
7120 KB |
Output is correct |
27 |
Correct |
3 ms |
1620 KB |
Output is correct |
28 |
Correct |
3 ms |
1620 KB |
Output is correct |
29 |
Correct |
2 ms |
960 KB |
Output is correct |
30 |
Correct |
2 ms |
928 KB |
Output is correct |
31 |
Correct |
2 ms |
948 KB |
Output is correct |
32 |
Correct |
2 ms |
980 KB |
Output is correct |
33 |
Correct |
8 ms |
5076 KB |
Output is correct |
34 |
Correct |
8 ms |
5076 KB |
Output is correct |
35 |
Correct |
7 ms |
5076 KB |
Output is correct |
36 |
Correct |
8 ms |
5092 KB |
Output is correct |
37 |
Correct |
8 ms |
5148 KB |
Output is correct |
38 |
Correct |
8 ms |
5096 KB |
Output is correct |
39 |
Correct |
18 ms |
8164 KB |
Output is correct |
40 |
Correct |
19 ms |
8144 KB |
Output is correct |
41 |
Correct |
15 ms |
8172 KB |
Output is correct |
42 |
Correct |
0 ms |
212 KB |
Output is correct |
43 |
Correct |
0 ms |
212 KB |
Output is correct |
44 |
Correct |
1 ms |
296 KB |
Output is correct |
45 |
Correct |
1 ms |
212 KB |
Output is correct |
46 |
Correct |
1 ms |
296 KB |
Output is correct |
47 |
Correct |
1 ms |
212 KB |
Output is correct |
48 |
Correct |
1 ms |
212 KB |
Output is correct |
49 |
Correct |
1 ms |
340 KB |
Output is correct |
50 |
Correct |
1 ms |
304 KB |
Output is correct |
51 |
Correct |
1 ms |
2260 KB |
Output is correct |
52 |
Correct |
1 ms |
1748 KB |
Output is correct |
53 |
Correct |
1 ms |
1620 KB |
Output is correct |
54 |
Correct |
2 ms |
2644 KB |
Output is correct |
55 |
Correct |
1 ms |
2228 KB |
Output is correct |
56 |
Correct |
1 ms |
2388 KB |
Output is correct |
57 |
Correct |
1 ms |
340 KB |
Output is correct |
58 |
Correct |
1 ms |
2132 KB |
Output is correct |
59 |
Correct |
1 ms |
288 KB |
Output is correct |
60 |
Correct |
1 ms |
2516 KB |
Output is correct |
61 |
Correct |
1 ms |
2516 KB |
Output is correct |
62 |
Correct |
1 ms |
340 KB |
Output is correct |
63 |
Correct |
1 ms |
340 KB |
Output is correct |
64 |
Correct |
1 ms |
212 KB |
Output is correct |
65 |
Correct |
1 ms |
212 KB |
Output is correct |
66 |
Correct |
1 ms |
212 KB |
Output is correct |
67 |
Correct |
1 ms |
212 KB |
Output is correct |
68 |
Correct |
1 ms |
2644 KB |
Output is correct |
69 |
Correct |
2 ms |
2644 KB |
Output is correct |
70 |
Correct |
2 ms |
2704 KB |
Output is correct |
71 |
Correct |
1 ms |
2732 KB |
Output is correct |
72 |
Correct |
2 ms |
2644 KB |
Output is correct |
73 |
Correct |
1 ms |
2608 KB |
Output is correct |
74 |
Correct |
1 ms |
2644 KB |
Output is correct |
75 |
Correct |
1 ms |
340 KB |
Output is correct |
76 |
Correct |
2 ms |
2644 KB |
Output is correct |
77 |
Correct |
1 ms |
340 KB |
Output is correct |
78 |
Correct |
2 ms |
2644 KB |
Output is correct |
79 |
Correct |
1 ms |
340 KB |
Output is correct |
80 |
Correct |
1 ms |
468 KB |
Output is correct |
81 |
Correct |
1 ms |
304 KB |
Output is correct |
82 |
Correct |
1 ms |
552 KB |
Output is correct |
83 |
Correct |
1 ms |
468 KB |
Output is correct |
84 |
Correct |
1 ms |
468 KB |
Output is correct |
85 |
Correct |
2 ms |
2552 KB |
Output is correct |
86 |
Correct |
2 ms |
2132 KB |
Output is correct |
87 |
Correct |
2 ms |
2004 KB |
Output is correct |
88 |
Correct |
2 ms |
2004 KB |
Output is correct |
89 |
Correct |
2 ms |
2388 KB |
Output is correct |
90 |
Correct |
2 ms |
2772 KB |
Output is correct |
91 |
Correct |
14 ms |
5176 KB |
Output is correct |
92 |
Correct |
14 ms |
6068 KB |
Output is correct |
93 |
Correct |
18 ms |
6892 KB |
Output is correct |
94 |
Correct |
1 ms |
680 KB |
Output is correct |
95 |
Correct |
2 ms |
724 KB |
Output is correct |
96 |
Correct |
2 ms |
724 KB |
Output is correct |
97 |
Correct |
2 ms |
724 KB |
Output is correct |
98 |
Correct |
2 ms |
724 KB |
Output is correct |
99 |
Correct |
3 ms |
2996 KB |
Output is correct |
100 |
Correct |
3 ms |
2996 KB |
Output is correct |
101 |
Correct |
3 ms |
3004 KB |
Output is correct |
102 |
Correct |
3 ms |
2900 KB |
Output is correct |
103 |
Correct |
3 ms |
2900 KB |
Output is correct |
104 |
Correct |
3 ms |
2900 KB |
Output is correct |
105 |
Correct |
19 ms |
7228 KB |
Output is correct |
106 |
Correct |
20 ms |
7248 KB |
Output is correct |
107 |
Correct |
19 ms |
7244 KB |
Output is correct |
108 |
Correct |
3 ms |
1632 KB |
Output is correct |
109 |
Correct |
79 ms |
36044 KB |
Output is correct |
110 |
Correct |
4 ms |
1748 KB |
Output is correct |
111 |
Correct |
3 ms |
1620 KB |
Output is correct |
112 |
Correct |
4 ms |
1748 KB |
Output is correct |
113 |
Correct |
5 ms |
1748 KB |
Output is correct |
114 |
Correct |
10 ms |
4740 KB |
Output is correct |
115 |
Correct |
10 ms |
4408 KB |
Output is correct |
116 |
Correct |
14 ms |
5308 KB |
Output is correct |
117 |
Correct |
9 ms |
4052 KB |
Output is correct |
118 |
Correct |
11 ms |
4760 KB |
Output is correct |
119 |
Correct |
12 ms |
4708 KB |
Output is correct |
120 |
Correct |
13 ms |
5156 KB |
Output is correct |
121 |
Correct |
6 ms |
1972 KB |
Output is correct |
122 |
Correct |
15 ms |
5264 KB |
Output is correct |
123 |
Correct |
4 ms |
1748 KB |
Output is correct |
124 |
Correct |
17 ms |
6564 KB |
Output is correct |
125 |
Correct |
6 ms |
2644 KB |
Output is correct |
126 |
Correct |
6 ms |
3540 KB |
Output is correct |
127 |
Correct |
8 ms |
4448 KB |
Output is correct |
128 |
Correct |
6 ms |
3668 KB |
Output is correct |
129 |
Correct |
8 ms |
3260 KB |
Output is correct |
130 |
Correct |
3 ms |
1620 KB |
Output is correct |
131 |
Correct |
111 ms |
50844 KB |
Output is correct |
132 |
Correct |
5 ms |
2516 KB |
Output is correct |
133 |
Correct |
5 ms |
2364 KB |
Output is correct |
134 |
Correct |
5 ms |
2388 KB |
Output is correct |
135 |
Correct |
5 ms |
2388 KB |
Output is correct |
136 |
Correct |
18 ms |
5920 KB |
Output is correct |
137 |
Correct |
14 ms |
5992 KB |
Output is correct |
138 |
Correct |
14 ms |
5972 KB |
Output is correct |
139 |
Correct |
14 ms |
5996 KB |
Output is correct |
140 |
Correct |
14 ms |
5940 KB |
Output is correct |
141 |
Correct |
15 ms |
5992 KB |
Output is correct |
142 |
Correct |
22 ms |
8276 KB |
Output is correct |
143 |
Correct |
7 ms |
3028 KB |
Output is correct |
144 |
Correct |
22 ms |
8184 KB |
Output is correct |
145 |
Correct |
7 ms |
3000 KB |
Output is correct |
146 |
Correct |
21 ms |
8268 KB |
Output is correct |
147 |
Correct |
7 ms |
3000 KB |
Output is correct |
148 |
Correct |
9 ms |
5332 KB |
Output is correct |
149 |
Correct |
8 ms |
5184 KB |
Output is correct |
150 |
Correct |
8 ms |
5076 KB |
Output is correct |
151 |
Correct |
8 ms |
5096 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
300 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
0 ms |
212 KB |
Output is correct |
7 |
Correct |
0 ms |
300 KB |
Output is correct |
8 |
Correct |
1 ms |
296 KB |
Output is correct |
9 |
Correct |
1 ms |
212 KB |
Output is correct |
10 |
Correct |
1 ms |
340 KB |
Output is correct |
11 |
Correct |
1 ms |
340 KB |
Output is correct |
12 |
Correct |
1 ms |
212 KB |
Output is correct |
13 |
Correct |
1 ms |
212 KB |
Output is correct |
14 |
Correct |
1 ms |
212 KB |
Output is correct |
15 |
Correct |
1 ms |
2608 KB |
Output is correct |
16 |
Correct |
1 ms |
2644 KB |
Output is correct |
17 |
Correct |
2 ms |
2644 KB |
Output is correct |
18 |
Correct |
1 ms |
2644 KB |
Output is correct |
19 |
Correct |
1 ms |
2644 KB |
Output is correct |
20 |
Correct |
2 ms |
2644 KB |
Output is correct |
21 |
Correct |
2 ms |
2736 KB |
Output is correct |
22 |
Correct |
1 ms |
2644 KB |
Output is correct |
23 |
Correct |
1 ms |
2644 KB |
Output is correct |
24 |
Correct |
18 ms |
7156 KB |
Output is correct |
25 |
Correct |
13 ms |
7124 KB |
Output is correct |
26 |
Correct |
13 ms |
7120 KB |
Output is correct |
27 |
Correct |
3 ms |
1620 KB |
Output is correct |
28 |
Correct |
3 ms |
1620 KB |
Output is correct |
29 |
Correct |
2 ms |
960 KB |
Output is correct |
30 |
Correct |
2 ms |
928 KB |
Output is correct |
31 |
Correct |
2 ms |
948 KB |
Output is correct |
32 |
Correct |
2 ms |
980 KB |
Output is correct |
33 |
Correct |
8 ms |
5076 KB |
Output is correct |
34 |
Correct |
8 ms |
5076 KB |
Output is correct |
35 |
Correct |
7 ms |
5076 KB |
Output is correct |
36 |
Correct |
8 ms |
5092 KB |
Output is correct |
37 |
Correct |
8 ms |
5148 KB |
Output is correct |
38 |
Correct |
8 ms |
5096 KB |
Output is correct |
39 |
Correct |
18 ms |
8164 KB |
Output is correct |
40 |
Correct |
19 ms |
8144 KB |
Output is correct |
41 |
Correct |
15 ms |
8172 KB |
Output is correct |
42 |
Correct |
12 ms |
6504 KB |
Output is correct |
43 |
Correct |
11 ms |
4148 KB |
Output is correct |
44 |
Correct |
15 ms |
6996 KB |
Output is correct |
45 |
Correct |
5 ms |
2644 KB |
Output is correct |
46 |
Correct |
7 ms |
2516 KB |
Output is correct |
47 |
Correct |
8 ms |
3964 KB |
Output is correct |
48 |
Correct |
36 ms |
18004 KB |
Output is correct |
49 |
Correct |
22 ms |
11468 KB |
Output is correct |
50 |
Correct |
25 ms |
13952 KB |
Output is correct |
51 |
Correct |
29 ms |
13824 KB |
Output is correct |
52 |
Correct |
30 ms |
13624 KB |
Output is correct |
53 |
Correct |
22 ms |
10604 KB |
Output is correct |
54 |
Correct |
14 ms |
7140 KB |
Output is correct |
55 |
Correct |
17 ms |
7124 KB |
Output is correct |
56 |
Correct |
14 ms |
7096 KB |
Output is correct |
57 |
Correct |
8 ms |
3972 KB |
Output is correct |
58 |
Correct |
8 ms |
4032 KB |
Output is correct |
59 |
Correct |
7 ms |
3924 KB |
Output is correct |
60 |
Correct |
39 ms |
19624 KB |
Output is correct |
61 |
Correct |
41 ms |
19716 KB |
Output is correct |
62 |
Correct |
40 ms |
19696 KB |
Output is correct |
63 |
Correct |
41 ms |
19660 KB |
Output is correct |
64 |
Correct |
40 ms |
19624 KB |
Output is correct |
65 |
Correct |
52 ms |
19648 KB |
Output is correct |
66 |
Correct |
37 ms |
17100 KB |
Output is correct |
67 |
Correct |
44 ms |
17192 KB |
Output is correct |
68 |
Correct |
50 ms |
17100 KB |
Output is correct |
69 |
Correct |
0 ms |
212 KB |
Output is correct |
70 |
Correct |
0 ms |
212 KB |
Output is correct |
71 |
Correct |
1 ms |
296 KB |
Output is correct |
72 |
Correct |
1 ms |
212 KB |
Output is correct |
73 |
Correct |
1 ms |
296 KB |
Output is correct |
74 |
Correct |
1 ms |
212 KB |
Output is correct |
75 |
Correct |
1 ms |
212 KB |
Output is correct |
76 |
Correct |
1 ms |
340 KB |
Output is correct |
77 |
Correct |
1 ms |
304 KB |
Output is correct |
78 |
Correct |
1 ms |
2260 KB |
Output is correct |
79 |
Correct |
1 ms |
1748 KB |
Output is correct |
80 |
Correct |
1 ms |
1620 KB |
Output is correct |
81 |
Correct |
2 ms |
2644 KB |
Output is correct |
82 |
Correct |
1 ms |
2228 KB |
Output is correct |
83 |
Correct |
1 ms |
2388 KB |
Output is correct |
84 |
Correct |
1 ms |
340 KB |
Output is correct |
85 |
Correct |
1 ms |
2132 KB |
Output is correct |
86 |
Correct |
1 ms |
288 KB |
Output is correct |
87 |
Correct |
1 ms |
2516 KB |
Output is correct |
88 |
Correct |
1 ms |
2516 KB |
Output is correct |
89 |
Correct |
1 ms |
340 KB |
Output is correct |
90 |
Correct |
1 ms |
340 KB |
Output is correct |
91 |
Correct |
1 ms |
212 KB |
Output is correct |
92 |
Correct |
1 ms |
212 KB |
Output is correct |
93 |
Correct |
1 ms |
212 KB |
Output is correct |
94 |
Correct |
1 ms |
212 KB |
Output is correct |
95 |
Correct |
1 ms |
2644 KB |
Output is correct |
96 |
Correct |
2 ms |
2644 KB |
Output is correct |
97 |
Correct |
2 ms |
2704 KB |
Output is correct |
98 |
Correct |
1 ms |
2732 KB |
Output is correct |
99 |
Correct |
2 ms |
2644 KB |
Output is correct |
100 |
Correct |
1 ms |
2608 KB |
Output is correct |
101 |
Correct |
1 ms |
2644 KB |
Output is correct |
102 |
Correct |
1 ms |
340 KB |
Output is correct |
103 |
Correct |
2 ms |
2644 KB |
Output is correct |
104 |
Correct |
1 ms |
340 KB |
Output is correct |
105 |
Correct |
2 ms |
2644 KB |
Output is correct |
106 |
Correct |
1 ms |
340 KB |
Output is correct |
107 |
Correct |
1 ms |
468 KB |
Output is correct |
108 |
Correct |
1 ms |
304 KB |
Output is correct |
109 |
Correct |
1 ms |
552 KB |
Output is correct |
110 |
Correct |
1 ms |
468 KB |
Output is correct |
111 |
Correct |
1 ms |
468 KB |
Output is correct |
112 |
Correct |
2 ms |
2552 KB |
Output is correct |
113 |
Correct |
2 ms |
2132 KB |
Output is correct |
114 |
Correct |
2 ms |
2004 KB |
Output is correct |
115 |
Correct |
2 ms |
2004 KB |
Output is correct |
116 |
Correct |
2 ms |
2388 KB |
Output is correct |
117 |
Correct |
2 ms |
2772 KB |
Output is correct |
118 |
Correct |
14 ms |
5176 KB |
Output is correct |
119 |
Correct |
14 ms |
6068 KB |
Output is correct |
120 |
Correct |
18 ms |
6892 KB |
Output is correct |
121 |
Correct |
1 ms |
680 KB |
Output is correct |
122 |
Correct |
2 ms |
724 KB |
Output is correct |
123 |
Correct |
2 ms |
724 KB |
Output is correct |
124 |
Correct |
2 ms |
724 KB |
Output is correct |
125 |
Correct |
2 ms |
724 KB |
Output is correct |
126 |
Correct |
3 ms |
2996 KB |
Output is correct |
127 |
Correct |
3 ms |
2996 KB |
Output is correct |
128 |
Correct |
3 ms |
3004 KB |
Output is correct |
129 |
Correct |
3 ms |
2900 KB |
Output is correct |
130 |
Correct |
3 ms |
2900 KB |
Output is correct |
131 |
Correct |
3 ms |
2900 KB |
Output is correct |
132 |
Correct |
19 ms |
7228 KB |
Output is correct |
133 |
Correct |
20 ms |
7248 KB |
Output is correct |
134 |
Correct |
19 ms |
7244 KB |
Output is correct |
135 |
Correct |
3 ms |
1632 KB |
Output is correct |
136 |
Correct |
79 ms |
36044 KB |
Output is correct |
137 |
Correct |
4 ms |
1748 KB |
Output is correct |
138 |
Correct |
3 ms |
1620 KB |
Output is correct |
139 |
Correct |
4 ms |
1748 KB |
Output is correct |
140 |
Correct |
5 ms |
1748 KB |
Output is correct |
141 |
Correct |
10 ms |
4740 KB |
Output is correct |
142 |
Correct |
10 ms |
4408 KB |
Output is correct |
143 |
Correct |
14 ms |
5308 KB |
Output is correct |
144 |
Correct |
9 ms |
4052 KB |
Output is correct |
145 |
Correct |
11 ms |
4760 KB |
Output is correct |
146 |
Correct |
12 ms |
4708 KB |
Output is correct |
147 |
Correct |
13 ms |
5156 KB |
Output is correct |
148 |
Correct |
6 ms |
1972 KB |
Output is correct |
149 |
Correct |
15 ms |
5264 KB |
Output is correct |
150 |
Correct |
4 ms |
1748 KB |
Output is correct |
151 |
Correct |
17 ms |
6564 KB |
Output is correct |
152 |
Correct |
6 ms |
2644 KB |
Output is correct |
153 |
Correct |
6 ms |
3540 KB |
Output is correct |
154 |
Correct |
8 ms |
4448 KB |
Output is correct |
155 |
Correct |
6 ms |
3668 KB |
Output is correct |
156 |
Correct |
8 ms |
3260 KB |
Output is correct |
157 |
Correct |
3 ms |
1620 KB |
Output is correct |
158 |
Correct |
111 ms |
50844 KB |
Output is correct |
159 |
Correct |
5 ms |
2516 KB |
Output is correct |
160 |
Correct |
5 ms |
2364 KB |
Output is correct |
161 |
Correct |
5 ms |
2388 KB |
Output is correct |
162 |
Correct |
5 ms |
2388 KB |
Output is correct |
163 |
Correct |
18 ms |
5920 KB |
Output is correct |
164 |
Correct |
14 ms |
5992 KB |
Output is correct |
165 |
Correct |
14 ms |
5972 KB |
Output is correct |
166 |
Correct |
14 ms |
5996 KB |
Output is correct |
167 |
Correct |
14 ms |
5940 KB |
Output is correct |
168 |
Correct |
15 ms |
5992 KB |
Output is correct |
169 |
Correct |
22 ms |
8276 KB |
Output is correct |
170 |
Correct |
7 ms |
3028 KB |
Output is correct |
171 |
Correct |
22 ms |
8184 KB |
Output is correct |
172 |
Correct |
7 ms |
3000 KB |
Output is correct |
173 |
Correct |
21 ms |
8268 KB |
Output is correct |
174 |
Correct |
7 ms |
3000 KB |
Output is correct |
175 |
Correct |
9 ms |
5332 KB |
Output is correct |
176 |
Correct |
8 ms |
5184 KB |
Output is correct |
177 |
Correct |
8 ms |
5076 KB |
Output is correct |
178 |
Correct |
8 ms |
5096 KB |
Output is correct |
179 |
Correct |
9 ms |
4500 KB |
Output is correct |
180 |
Correct |
242 ms |
101636 KB |
Output is correct |
181 |
Correct |
9 ms |
4200 KB |
Output is correct |
182 |
Correct |
11 ms |
5408 KB |
Output is correct |
183 |
Correct |
8 ms |
4032 KB |
Output is correct |
184 |
Correct |
7 ms |
3764 KB |
Output is correct |
185 |
Correct |
24 ms |
8880 KB |
Output is correct |
186 |
Correct |
24 ms |
11416 KB |
Output is correct |
187 |
Correct |
27 ms |
10624 KB |
Output is correct |
188 |
Correct |
21 ms |
8940 KB |
Output is correct |
189 |
Correct |
29 ms |
11880 KB |
Output is correct |
190 |
Correct |
26 ms |
9764 KB |
Output is correct |
191 |
Correct |
28 ms |
11852 KB |
Output is correct |
192 |
Correct |
17 ms |
7500 KB |
Output is correct |
193 |
Correct |
21 ms |
8784 KB |
Output is correct |
194 |
Correct |
14 ms |
7044 KB |
Output is correct |
195 |
Correct |
574 ms |
253020 KB |
Output is correct |
196 |
Correct |
12 ms |
5692 KB |
Output is correct |
197 |
Correct |
15 ms |
5844 KB |
Output is correct |
198 |
Correct |
12 ms |
5688 KB |
Output is correct |
199 |
Correct |
14 ms |
5716 KB |
Output is correct |
200 |
Correct |
53 ms |
20272 KB |
Output is correct |
201 |
Correct |
52 ms |
20216 KB |
Output is correct |
202 |
Correct |
51 ms |
20324 KB |
Output is correct |
203 |
Correct |
53 ms |
20280 KB |
Output is correct |
204 |
Correct |
53 ms |
20288 KB |
Output is correct |
205 |
Correct |
52 ms |
20248 KB |
Output is correct |
206 |
Correct |
44 ms |
17208 KB |
Output is correct |
207 |
Correct |
42 ms |
18588 KB |
Output is correct |
208 |
Correct |
43 ms |
17220 KB |
Output is correct |
209 |
Correct |
48 ms |
18500 KB |
Output is correct |
210 |
Correct |
43 ms |
17248 KB |
Output is correct |
211 |
Correct |
42 ms |
18508 KB |
Output is correct |
212 |
Correct |
49 ms |
20004 KB |
Output is correct |
213 |
Correct |
42 ms |
16924 KB |
Output is correct |
214 |
Correct |
40 ms |
16328 KB |
Output is correct |
215 |
Correct |
40 ms |
16208 KB |
Output is correct |