#include <bits/stdc++.h>
#include "paint.h"
#pragma GCC target("sse,sse2,sse4,avx2")
#pragma GCC optimize("unroll-loops,O2")
#define rep(i,l,r) for (int i = l; i < r; i++)
#define repr(i,r,l) for (int i = r; i >= l; i--)
#define X first
#define Y second
#define all(x) (x).begin() , (x).end()
#define pb push_back
#define endl '\n'
#define debug(x) cerr << #x << " : " << x << endl;
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pll;
constexpr int N = 1e5+20,mod = 998244353,inf = 1e9+10;
inline int mkay(int a,int b){
if (a+b >= mod) return a+b-mod;
// if (a+b < 0) return a+b+mod;
return a+b;
}
inline int poww(int a,int k){
if (k < 0) return 0;
int z = 1;
while (k){
if (k&1) z = 1ll*z*a%mod;
a = 1ll*a*a%mod;
k >>= 1;
}
return z;
}
vector<int> f[N],a,c;
vector<vector<int> > b;
int n,m,k,dp[N];
vector<int> lst[N];
int minimumInstructions(int nn,int mm,int kk,vector<int> C,vector<int> A,vector<vector<int>> B){
n = nn;
m = mm;
k = kk;
c = C;
a = A;
b = B;
rep(i,0,m){
for (int x : b[i])
f[x].pb(i);
}
rep(i,0,n)
if (f[c[i]].empty()) return -1;
for(int x : f[c[n-1]]){
lst[n-1].pb(n-1);
}
dp[n-1] = n-1;
repr(i,n-2,0){
dp[i] = i;
int po = 0;
for (int x : f[c[i]]){
int y = x+1;
if (y == m) y = 0;
int ind;
if (y == 0){
if (f[c[i+1]][0] != 0) lst[i].pb(i);
else{
int cal = lst[i+1][0];
if (cal-i+1 > m) cal--;
lst[i].pb(cal);
dp[i] = max(dp[i],cal);
continue;
}
}
int sz = f[c[i+1]].size();
while (po < sz && f[c[i+1]][po] < y) po++;
if (po == sz || f[c[i+1]][po] != y){
lst[i].pb(i);
continue;
}
ind = po;
int cal = lst[i+1][ind];
if (cal-i+1 > m) cal--;
lst[i].pb(cal);
dp[i] = max(dp[i],cal);
}
}
int ans = 0;
int cur = 0,rel = -1;
while (cur < n){
bool f = 0;
repr(i,cur,rel+1){
if(dp[i]-i+1 == m){
cur = i+m;
rel = i;
f = 1;
break;
}
}
if (!f) return -1;
ans++;
}
return ans;
}
Compilation message
paint.cpp: In function 'int minimumInstructions(int, int, int, std::vector<int>, std::vector<int>, std::vector<std::vector<int> >)':
paint.cpp:51:13: warning: unused variable 'x' [-Wunused-variable]
51 | for(int x : f[c[n-1]]){
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4996 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4948 KB |
Output is correct |
5 |
Correct |
3 ms |
4996 KB |
Output is correct |
6 |
Correct |
3 ms |
5076 KB |
Output is correct |
7 |
Correct |
4 ms |
4948 KB |
Output is correct |
8 |
Correct |
4 ms |
4948 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
5004 KB |
Output is correct |
11 |
Correct |
3 ms |
5004 KB |
Output is correct |
12 |
Correct |
3 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
5076 KB |
Output is correct |
14 |
Correct |
3 ms |
5008 KB |
Output is correct |
15 |
Correct |
3 ms |
5088 KB |
Output is correct |
16 |
Correct |
3 ms |
5076 KB |
Output is correct |
17 |
Correct |
3 ms |
5004 KB |
Output is correct |
18 |
Correct |
4 ms |
5076 KB |
Output is correct |
19 |
Correct |
3 ms |
5076 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
4 ms |
5076 KB |
Output is correct |
22 |
Correct |
28 ms |
9736 KB |
Output is correct |
23 |
Correct |
21 ms |
9788 KB |
Output is correct |
24 |
Correct |
18 ms |
9728 KB |
Output is correct |
25 |
Correct |
6 ms |
5972 KB |
Output is correct |
26 |
Correct |
5 ms |
5912 KB |
Output is correct |
27 |
Correct |
6 ms |
5916 KB |
Output is correct |
28 |
Correct |
6 ms |
5972 KB |
Output is correct |
29 |
Correct |
5 ms |
5972 KB |
Output is correct |
30 |
Correct |
6 ms |
5844 KB |
Output is correct |
31 |
Correct |
11 ms |
7236 KB |
Output is correct |
32 |
Correct |
12 ms |
7172 KB |
Output is correct |
33 |
Correct |
11 ms |
7192 KB |
Output is correct |
34 |
Correct |
11 ms |
7124 KB |
Output is correct |
35 |
Correct |
10 ms |
7244 KB |
Output is correct |
36 |
Correct |
10 ms |
7220 KB |
Output is correct |
37 |
Correct |
24 ms |
10900 KB |
Output is correct |
38 |
Correct |
24 ms |
10952 KB |
Output is correct |
39 |
Correct |
24 ms |
10980 KB |
Output is correct |
40 |
Correct |
14 ms |
9392 KB |
Output is correct |
41 |
Correct |
10 ms |
7764 KB |
Output is correct |
42 |
Correct |
16 ms |
9812 KB |
Output is correct |
43 |
Correct |
12 ms |
8200 KB |
Output is correct |
44 |
Correct |
13 ms |
7828 KB |
Output is correct |
45 |
Correct |
22 ms |
9880 KB |
Output is correct |
46 |
Correct |
69 ms |
20812 KB |
Output is correct |
47 |
Correct |
30 ms |
14108 KB |
Output is correct |
48 |
Correct |
37 ms |
17868 KB |
Output is correct |
49 |
Correct |
43 ms |
17764 KB |
Output is correct |
50 |
Correct |
42 ms |
17500 KB |
Output is correct |
51 |
Correct |
38 ms |
14620 KB |
Output is correct |
52 |
Correct |
16 ms |
9872 KB |
Output is correct |
53 |
Correct |
15 ms |
9828 KB |
Output is correct |
54 |
Correct |
25 ms |
9832 KB |
Output is correct |
55 |
Correct |
18 ms |
9812 KB |
Output is correct |
56 |
Correct |
20 ms |
9792 KB |
Output is correct |
57 |
Correct |
17 ms |
9812 KB |
Output is correct |
58 |
Correct |
49 ms |
22136 KB |
Output is correct |
59 |
Correct |
53 ms |
22016 KB |
Output is correct |
60 |
Correct |
68 ms |
22144 KB |
Output is correct |
61 |
Correct |
49 ms |
22092 KB |
Output is correct |
62 |
Correct |
49 ms |
22132 KB |
Output is correct |
63 |
Correct |
52 ms |
22016 KB |
Output is correct |
64 |
Correct |
52 ms |
20880 KB |
Output is correct |
65 |
Correct |
77 ms |
20940 KB |
Output is correct |
66 |
Correct |
55 ms |
20936 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4996 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4948 KB |
Output is correct |
5 |
Correct |
3 ms |
4996 KB |
Output is correct |
6 |
Correct |
3 ms |
5076 KB |
Output is correct |
7 |
Correct |
4 ms |
4948 KB |
Output is correct |
8 |
Correct |
4 ms |
4948 KB |
Output is correct |
9 |
Correct |
3 ms |
4948 KB |
Output is correct |
10 |
Correct |
3 ms |
5004 KB |
Output is correct |
11 |
Correct |
3 ms |
5004 KB |
Output is correct |
12 |
Correct |
3 ms |
4948 KB |
Output is correct |
13 |
Correct |
3 ms |
5076 KB |
Output is correct |
14 |
Correct |
3 ms |
5008 KB |
Output is correct |
15 |
Correct |
3 ms |
5088 KB |
Output is correct |
16 |
Correct |
3 ms |
5076 KB |
Output is correct |
17 |
Correct |
3 ms |
5004 KB |
Output is correct |
18 |
Correct |
4 ms |
5076 KB |
Output is correct |
19 |
Correct |
3 ms |
5076 KB |
Output is correct |
20 |
Correct |
3 ms |
5076 KB |
Output is correct |
21 |
Correct |
4 ms |
5076 KB |
Output is correct |
22 |
Correct |
3 ms |
4948 KB |
Output is correct |
23 |
Correct |
3 ms |
4948 KB |
Output is correct |
24 |
Correct |
3 ms |
4948 KB |
Output is correct |
25 |
Correct |
3 ms |
5000 KB |
Output is correct |
26 |
Correct |
3 ms |
4948 KB |
Output is correct |
27 |
Correct |
3 ms |
4924 KB |
Output is correct |
28 |
Correct |
4 ms |
4948 KB |
Output is correct |
29 |
Correct |
3 ms |
4948 KB |
Output is correct |
30 |
Correct |
3 ms |
4996 KB |
Output is correct |
31 |
Correct |
3 ms |
4948 KB |
Output is correct |
32 |
Correct |
3 ms |
4996 KB |
Output is correct |
33 |
Correct |
3 ms |
4948 KB |
Output is correct |
34 |
Correct |
3 ms |
4948 KB |
Output is correct |
35 |
Correct |
3 ms |
5000 KB |
Output is correct |
36 |
Correct |
3 ms |
5008 KB |
Output is correct |
37 |
Correct |
3 ms |
5076 KB |
Output is correct |
38 |
Correct |
3 ms |
5008 KB |
Output is correct |
39 |
Correct |
3 ms |
4948 KB |
Output is correct |
40 |
Correct |
3 ms |
5076 KB |
Output is correct |
41 |
Correct |
3 ms |
5004 KB |
Output is correct |
42 |
Correct |
3 ms |
5004 KB |
Output is correct |
43 |
Correct |
3 ms |
4948 KB |
Output is correct |
44 |
Correct |
4 ms |
4948 KB |
Output is correct |
45 |
Correct |
3 ms |
5076 KB |
Output is correct |
46 |
Correct |
4 ms |
5076 KB |
Output is correct |
47 |
Correct |
4 ms |
5076 KB |
Output is correct |
48 |
Correct |
3 ms |
5004 KB |
Output is correct |
49 |
Correct |
3 ms |
4948 KB |
Output is correct |
50 |
Correct |
3 ms |
5004 KB |
Output is correct |
51 |
Correct |
3 ms |
5076 KB |
Output is correct |
52 |
Correct |
3 ms |
4948 KB |
Output is correct |
53 |
Correct |
3 ms |
5076 KB |
Output is correct |
54 |
Correct |
3 ms |
5076 KB |
Output is correct |
55 |
Correct |
3 ms |
5076 KB |
Output is correct |
56 |
Correct |
3 ms |
5076 KB |
Output is correct |
57 |
Correct |
3 ms |
5076 KB |
Output is correct |
58 |
Correct |
3 ms |
5076 KB |
Output is correct |
59 |
Correct |
3 ms |
4948 KB |
Output is correct |
60 |
Correct |
3 ms |
5088 KB |
Output is correct |
61 |
Correct |
4 ms |
5076 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4996 KB |
Output is correct |
5 |
Correct |
3 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
3 ms |
4996 KB |
Output is correct |
8 |
Correct |
3 ms |
5076 KB |
Output is correct |
9 |
Correct |
4 ms |
4948 KB |
Output is correct |
10 |
Correct |
4 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 ms |
5004 KB |
Output is correct |
13 |
Correct |
3 ms |
5004 KB |
Output is correct |
14 |
Correct |
3 ms |
4948 KB |
Output is correct |
15 |
Correct |
3 ms |
5076 KB |
Output is correct |
16 |
Correct |
3 ms |
5008 KB |
Output is correct |
17 |
Correct |
3 ms |
5088 KB |
Output is correct |
18 |
Correct |
3 ms |
5076 KB |
Output is correct |
19 |
Correct |
3 ms |
5004 KB |
Output is correct |
20 |
Correct |
4 ms |
5076 KB |
Output is correct |
21 |
Correct |
3 ms |
5076 KB |
Output is correct |
22 |
Correct |
3 ms |
5076 KB |
Output is correct |
23 |
Correct |
4 ms |
5076 KB |
Output is correct |
24 |
Correct |
28 ms |
9736 KB |
Output is correct |
25 |
Correct |
21 ms |
9788 KB |
Output is correct |
26 |
Correct |
18 ms |
9728 KB |
Output is correct |
27 |
Correct |
3 ms |
4948 KB |
Output is correct |
28 |
Correct |
3 ms |
5000 KB |
Output is correct |
29 |
Correct |
3 ms |
4948 KB |
Output is correct |
30 |
Correct |
3 ms |
4924 KB |
Output is correct |
31 |
Correct |
4 ms |
4948 KB |
Output is correct |
32 |
Correct |
3 ms |
4948 KB |
Output is correct |
33 |
Correct |
3 ms |
4996 KB |
Output is correct |
34 |
Correct |
3 ms |
4948 KB |
Output is correct |
35 |
Correct |
3 ms |
4996 KB |
Output is correct |
36 |
Correct |
3 ms |
4948 KB |
Output is correct |
37 |
Correct |
3 ms |
4948 KB |
Output is correct |
38 |
Correct |
3 ms |
5000 KB |
Output is correct |
39 |
Correct |
3 ms |
5008 KB |
Output is correct |
40 |
Correct |
3 ms |
5076 KB |
Output is correct |
41 |
Correct |
3 ms |
5008 KB |
Output is correct |
42 |
Correct |
3 ms |
4948 KB |
Output is correct |
43 |
Correct |
3 ms |
5076 KB |
Output is correct |
44 |
Correct |
3 ms |
5004 KB |
Output is correct |
45 |
Correct |
3 ms |
5004 KB |
Output is correct |
46 |
Correct |
3 ms |
4948 KB |
Output is correct |
47 |
Correct |
4 ms |
4948 KB |
Output is correct |
48 |
Correct |
3 ms |
5076 KB |
Output is correct |
49 |
Correct |
4 ms |
5076 KB |
Output is correct |
50 |
Correct |
4 ms |
5076 KB |
Output is correct |
51 |
Correct |
3 ms |
5004 KB |
Output is correct |
52 |
Correct |
3 ms |
4948 KB |
Output is correct |
53 |
Correct |
3 ms |
5004 KB |
Output is correct |
54 |
Correct |
3 ms |
5076 KB |
Output is correct |
55 |
Correct |
3 ms |
4948 KB |
Output is correct |
56 |
Correct |
3 ms |
5076 KB |
Output is correct |
57 |
Correct |
3 ms |
5076 KB |
Output is correct |
58 |
Correct |
3 ms |
5076 KB |
Output is correct |
59 |
Correct |
3 ms |
5076 KB |
Output is correct |
60 |
Correct |
3 ms |
5076 KB |
Output is correct |
61 |
Correct |
3 ms |
5076 KB |
Output is correct |
62 |
Correct |
3 ms |
4948 KB |
Output is correct |
63 |
Correct |
3 ms |
5088 KB |
Output is correct |
64 |
Correct |
4 ms |
5076 KB |
Output is correct |
65 |
Correct |
4 ms |
5204 KB |
Output is correct |
66 |
Correct |
4 ms |
5076 KB |
Output is correct |
67 |
Correct |
4 ms |
5204 KB |
Output is correct |
68 |
Correct |
4 ms |
5204 KB |
Output is correct |
69 |
Correct |
3 ms |
5260 KB |
Output is correct |
70 |
Correct |
5 ms |
5260 KB |
Output is correct |
71 |
Correct |
4 ms |
5272 KB |
Output is correct |
72 |
Correct |
7 ms |
5268 KB |
Output is correct |
73 |
Correct |
3 ms |
5204 KB |
Output is correct |
74 |
Correct |
4 ms |
5268 KB |
Output is correct |
75 |
Correct |
6 ms |
5192 KB |
Output is correct |
76 |
Correct |
31 ms |
8544 KB |
Output is correct |
77 |
Correct |
18 ms |
8984 KB |
Output is correct |
78 |
Correct |
24 ms |
9480 KB |
Output is correct |
79 |
Correct |
5 ms |
5460 KB |
Output is correct |
80 |
Correct |
4 ms |
5460 KB |
Output is correct |
81 |
Correct |
4 ms |
5512 KB |
Output is correct |
82 |
Correct |
5 ms |
5460 KB |
Output is correct |
83 |
Correct |
4 ms |
5516 KB |
Output is correct |
84 |
Correct |
5 ms |
5332 KB |
Output is correct |
85 |
Correct |
5 ms |
5332 KB |
Output is correct |
86 |
Correct |
5 ms |
5332 KB |
Output is correct |
87 |
Correct |
5 ms |
5396 KB |
Output is correct |
88 |
Correct |
5 ms |
5332 KB |
Output is correct |
89 |
Correct |
4 ms |
5332 KB |
Output is correct |
90 |
Correct |
26 ms |
9804 KB |
Output is correct |
91 |
Correct |
31 ms |
9852 KB |
Output is correct |
92 |
Correct |
62 ms |
9796 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4996 KB |
Output is correct |
5 |
Correct |
3 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
3 ms |
4996 KB |
Output is correct |
8 |
Correct |
3 ms |
5076 KB |
Output is correct |
9 |
Correct |
4 ms |
4948 KB |
Output is correct |
10 |
Correct |
4 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 ms |
5004 KB |
Output is correct |
13 |
Correct |
3 ms |
5004 KB |
Output is correct |
14 |
Correct |
3 ms |
4948 KB |
Output is correct |
15 |
Correct |
3 ms |
5076 KB |
Output is correct |
16 |
Correct |
3 ms |
5008 KB |
Output is correct |
17 |
Correct |
3 ms |
5088 KB |
Output is correct |
18 |
Correct |
3 ms |
5076 KB |
Output is correct |
19 |
Correct |
3 ms |
5004 KB |
Output is correct |
20 |
Correct |
4 ms |
5076 KB |
Output is correct |
21 |
Correct |
3 ms |
5076 KB |
Output is correct |
22 |
Correct |
3 ms |
5076 KB |
Output is correct |
23 |
Correct |
4 ms |
5076 KB |
Output is correct |
24 |
Correct |
28 ms |
9736 KB |
Output is correct |
25 |
Correct |
21 ms |
9788 KB |
Output is correct |
26 |
Correct |
18 ms |
9728 KB |
Output is correct |
27 |
Correct |
6 ms |
5972 KB |
Output is correct |
28 |
Correct |
5 ms |
5912 KB |
Output is correct |
29 |
Correct |
6 ms |
5916 KB |
Output is correct |
30 |
Correct |
6 ms |
5972 KB |
Output is correct |
31 |
Correct |
5 ms |
5972 KB |
Output is correct |
32 |
Correct |
6 ms |
5844 KB |
Output is correct |
33 |
Correct |
11 ms |
7236 KB |
Output is correct |
34 |
Correct |
12 ms |
7172 KB |
Output is correct |
35 |
Correct |
11 ms |
7192 KB |
Output is correct |
36 |
Correct |
11 ms |
7124 KB |
Output is correct |
37 |
Correct |
10 ms |
7244 KB |
Output is correct |
38 |
Correct |
10 ms |
7220 KB |
Output is correct |
39 |
Correct |
24 ms |
10900 KB |
Output is correct |
40 |
Correct |
24 ms |
10952 KB |
Output is correct |
41 |
Correct |
24 ms |
10980 KB |
Output is correct |
42 |
Correct |
3 ms |
4948 KB |
Output is correct |
43 |
Correct |
3 ms |
5000 KB |
Output is correct |
44 |
Correct |
3 ms |
4948 KB |
Output is correct |
45 |
Correct |
3 ms |
4924 KB |
Output is correct |
46 |
Correct |
4 ms |
4948 KB |
Output is correct |
47 |
Correct |
3 ms |
4948 KB |
Output is correct |
48 |
Correct |
3 ms |
4996 KB |
Output is correct |
49 |
Correct |
3 ms |
4948 KB |
Output is correct |
50 |
Correct |
3 ms |
4996 KB |
Output is correct |
51 |
Correct |
3 ms |
4948 KB |
Output is correct |
52 |
Correct |
3 ms |
4948 KB |
Output is correct |
53 |
Correct |
3 ms |
5000 KB |
Output is correct |
54 |
Correct |
3 ms |
5008 KB |
Output is correct |
55 |
Correct |
3 ms |
5076 KB |
Output is correct |
56 |
Correct |
3 ms |
5008 KB |
Output is correct |
57 |
Correct |
3 ms |
4948 KB |
Output is correct |
58 |
Correct |
3 ms |
5076 KB |
Output is correct |
59 |
Correct |
3 ms |
5004 KB |
Output is correct |
60 |
Correct |
3 ms |
5004 KB |
Output is correct |
61 |
Correct |
3 ms |
4948 KB |
Output is correct |
62 |
Correct |
4 ms |
4948 KB |
Output is correct |
63 |
Correct |
3 ms |
5076 KB |
Output is correct |
64 |
Correct |
4 ms |
5076 KB |
Output is correct |
65 |
Correct |
4 ms |
5076 KB |
Output is correct |
66 |
Correct |
3 ms |
5004 KB |
Output is correct |
67 |
Correct |
3 ms |
4948 KB |
Output is correct |
68 |
Correct |
3 ms |
5004 KB |
Output is correct |
69 |
Correct |
3 ms |
5076 KB |
Output is correct |
70 |
Correct |
3 ms |
4948 KB |
Output is correct |
71 |
Correct |
3 ms |
5076 KB |
Output is correct |
72 |
Correct |
3 ms |
5076 KB |
Output is correct |
73 |
Correct |
3 ms |
5076 KB |
Output is correct |
74 |
Correct |
3 ms |
5076 KB |
Output is correct |
75 |
Correct |
3 ms |
5076 KB |
Output is correct |
76 |
Correct |
3 ms |
5076 KB |
Output is correct |
77 |
Correct |
3 ms |
4948 KB |
Output is correct |
78 |
Correct |
3 ms |
5088 KB |
Output is correct |
79 |
Correct |
4 ms |
5076 KB |
Output is correct |
80 |
Correct |
4 ms |
5204 KB |
Output is correct |
81 |
Correct |
4 ms |
5076 KB |
Output is correct |
82 |
Correct |
4 ms |
5204 KB |
Output is correct |
83 |
Correct |
4 ms |
5204 KB |
Output is correct |
84 |
Correct |
3 ms |
5260 KB |
Output is correct |
85 |
Correct |
5 ms |
5260 KB |
Output is correct |
86 |
Correct |
4 ms |
5272 KB |
Output is correct |
87 |
Correct |
7 ms |
5268 KB |
Output is correct |
88 |
Correct |
3 ms |
5204 KB |
Output is correct |
89 |
Correct |
4 ms |
5268 KB |
Output is correct |
90 |
Correct |
6 ms |
5192 KB |
Output is correct |
91 |
Correct |
31 ms |
8544 KB |
Output is correct |
92 |
Correct |
18 ms |
8984 KB |
Output is correct |
93 |
Correct |
24 ms |
9480 KB |
Output is correct |
94 |
Correct |
5 ms |
5460 KB |
Output is correct |
95 |
Correct |
4 ms |
5460 KB |
Output is correct |
96 |
Correct |
4 ms |
5512 KB |
Output is correct |
97 |
Correct |
5 ms |
5460 KB |
Output is correct |
98 |
Correct |
4 ms |
5516 KB |
Output is correct |
99 |
Correct |
5 ms |
5332 KB |
Output is correct |
100 |
Correct |
5 ms |
5332 KB |
Output is correct |
101 |
Correct |
5 ms |
5332 KB |
Output is correct |
102 |
Correct |
5 ms |
5396 KB |
Output is correct |
103 |
Correct |
5 ms |
5332 KB |
Output is correct |
104 |
Correct |
4 ms |
5332 KB |
Output is correct |
105 |
Correct |
26 ms |
9804 KB |
Output is correct |
106 |
Correct |
31 ms |
9852 KB |
Output is correct |
107 |
Correct |
62 ms |
9796 KB |
Output is correct |
108 |
Correct |
6 ms |
5972 KB |
Output is correct |
109 |
Correct |
101 ms |
63652 KB |
Output is correct |
110 |
Correct |
68 ms |
30128 KB |
Output is correct |
111 |
Correct |
63 ms |
28540 KB |
Output is correct |
112 |
Correct |
81 ms |
36360 KB |
Output is correct |
113 |
Correct |
54 ms |
20508 KB |
Output is correct |
114 |
Correct |
15 ms |
7380 KB |
Output is correct |
115 |
Correct |
15 ms |
7240 KB |
Output is correct |
116 |
Correct |
19 ms |
7800 KB |
Output is correct |
117 |
Correct |
17 ms |
7228 KB |
Output is correct |
118 |
Correct |
16 ms |
7648 KB |
Output is correct |
119 |
Correct |
19 ms |
7020 KB |
Output is correct |
120 |
Correct |
21 ms |
8360 KB |
Output is correct |
121 |
Correct |
7 ms |
6164 KB |
Output is correct |
122 |
Correct |
21 ms |
8596 KB |
Output is correct |
123 |
Correct |
8 ms |
5972 KB |
Output is correct |
124 |
Correct |
28 ms |
9292 KB |
Output is correct |
125 |
Correct |
9 ms |
6612 KB |
Output is correct |
126 |
Correct |
12 ms |
6660 KB |
Output is correct |
127 |
Correct |
11 ms |
7084 KB |
Output is correct |
128 |
Correct |
11 ms |
6484 KB |
Output is correct |
129 |
Correct |
11 ms |
6484 KB |
Output is correct |
130 |
Correct |
6 ms |
5972 KB |
Output is correct |
131 |
Correct |
139 ms |
85852 KB |
Output is correct |
132 |
Correct |
124 ms |
45796 KB |
Output is correct |
133 |
Correct |
120 ms |
45836 KB |
Output is correct |
134 |
Correct |
113 ms |
45836 KB |
Output is correct |
135 |
Correct |
119 ms |
41884 KB |
Output is correct |
136 |
Correct |
30 ms |
8012 KB |
Output is correct |
137 |
Correct |
27 ms |
8124 KB |
Output is correct |
138 |
Correct |
24 ms |
8012 KB |
Output is correct |
139 |
Correct |
21 ms |
8128 KB |
Output is correct |
140 |
Correct |
21 ms |
8032 KB |
Output is correct |
141 |
Correct |
20 ms |
8140 KB |
Output is correct |
142 |
Correct |
28 ms |
10124 KB |
Output is correct |
143 |
Correct |
11 ms |
6936 KB |
Output is correct |
144 |
Correct |
33 ms |
10056 KB |
Output is correct |
145 |
Correct |
13 ms |
6996 KB |
Output is correct |
146 |
Correct |
32 ms |
10152 KB |
Output is correct |
147 |
Correct |
10 ms |
6996 KB |
Output is correct |
148 |
Correct |
13 ms |
7492 KB |
Output is correct |
149 |
Correct |
12 ms |
7360 KB |
Output is correct |
150 |
Correct |
11 ms |
7248 KB |
Output is correct |
151 |
Correct |
12 ms |
7124 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
4948 KB |
Output is correct |
2 |
Correct |
3 ms |
4948 KB |
Output is correct |
3 |
Correct |
3 ms |
4948 KB |
Output is correct |
4 |
Correct |
3 ms |
4996 KB |
Output is correct |
5 |
Correct |
3 ms |
4948 KB |
Output is correct |
6 |
Correct |
3 ms |
4948 KB |
Output is correct |
7 |
Correct |
3 ms |
4996 KB |
Output is correct |
8 |
Correct |
3 ms |
5076 KB |
Output is correct |
9 |
Correct |
4 ms |
4948 KB |
Output is correct |
10 |
Correct |
4 ms |
4948 KB |
Output is correct |
11 |
Correct |
3 ms |
4948 KB |
Output is correct |
12 |
Correct |
3 ms |
5004 KB |
Output is correct |
13 |
Correct |
3 ms |
5004 KB |
Output is correct |
14 |
Correct |
3 ms |
4948 KB |
Output is correct |
15 |
Correct |
3 ms |
5076 KB |
Output is correct |
16 |
Correct |
3 ms |
5008 KB |
Output is correct |
17 |
Correct |
3 ms |
5088 KB |
Output is correct |
18 |
Correct |
3 ms |
5076 KB |
Output is correct |
19 |
Correct |
3 ms |
5004 KB |
Output is correct |
20 |
Correct |
4 ms |
5076 KB |
Output is correct |
21 |
Correct |
3 ms |
5076 KB |
Output is correct |
22 |
Correct |
3 ms |
5076 KB |
Output is correct |
23 |
Correct |
4 ms |
5076 KB |
Output is correct |
24 |
Correct |
28 ms |
9736 KB |
Output is correct |
25 |
Correct |
21 ms |
9788 KB |
Output is correct |
26 |
Correct |
18 ms |
9728 KB |
Output is correct |
27 |
Correct |
6 ms |
5972 KB |
Output is correct |
28 |
Correct |
5 ms |
5912 KB |
Output is correct |
29 |
Correct |
6 ms |
5916 KB |
Output is correct |
30 |
Correct |
6 ms |
5972 KB |
Output is correct |
31 |
Correct |
5 ms |
5972 KB |
Output is correct |
32 |
Correct |
6 ms |
5844 KB |
Output is correct |
33 |
Correct |
11 ms |
7236 KB |
Output is correct |
34 |
Correct |
12 ms |
7172 KB |
Output is correct |
35 |
Correct |
11 ms |
7192 KB |
Output is correct |
36 |
Correct |
11 ms |
7124 KB |
Output is correct |
37 |
Correct |
10 ms |
7244 KB |
Output is correct |
38 |
Correct |
10 ms |
7220 KB |
Output is correct |
39 |
Correct |
24 ms |
10900 KB |
Output is correct |
40 |
Correct |
24 ms |
10952 KB |
Output is correct |
41 |
Correct |
24 ms |
10980 KB |
Output is correct |
42 |
Correct |
14 ms |
9392 KB |
Output is correct |
43 |
Correct |
10 ms |
7764 KB |
Output is correct |
44 |
Correct |
16 ms |
9812 KB |
Output is correct |
45 |
Correct |
12 ms |
8200 KB |
Output is correct |
46 |
Correct |
13 ms |
7828 KB |
Output is correct |
47 |
Correct |
22 ms |
9880 KB |
Output is correct |
48 |
Correct |
69 ms |
20812 KB |
Output is correct |
49 |
Correct |
30 ms |
14108 KB |
Output is correct |
50 |
Correct |
37 ms |
17868 KB |
Output is correct |
51 |
Correct |
43 ms |
17764 KB |
Output is correct |
52 |
Correct |
42 ms |
17500 KB |
Output is correct |
53 |
Correct |
38 ms |
14620 KB |
Output is correct |
54 |
Correct |
16 ms |
9872 KB |
Output is correct |
55 |
Correct |
15 ms |
9828 KB |
Output is correct |
56 |
Correct |
25 ms |
9832 KB |
Output is correct |
57 |
Correct |
18 ms |
9812 KB |
Output is correct |
58 |
Correct |
20 ms |
9792 KB |
Output is correct |
59 |
Correct |
17 ms |
9812 KB |
Output is correct |
60 |
Correct |
49 ms |
22136 KB |
Output is correct |
61 |
Correct |
53 ms |
22016 KB |
Output is correct |
62 |
Correct |
68 ms |
22144 KB |
Output is correct |
63 |
Correct |
49 ms |
22092 KB |
Output is correct |
64 |
Correct |
49 ms |
22132 KB |
Output is correct |
65 |
Correct |
52 ms |
22016 KB |
Output is correct |
66 |
Correct |
52 ms |
20880 KB |
Output is correct |
67 |
Correct |
77 ms |
20940 KB |
Output is correct |
68 |
Correct |
55 ms |
20936 KB |
Output is correct |
69 |
Correct |
3 ms |
4948 KB |
Output is correct |
70 |
Correct |
3 ms |
5000 KB |
Output is correct |
71 |
Correct |
3 ms |
4948 KB |
Output is correct |
72 |
Correct |
3 ms |
4924 KB |
Output is correct |
73 |
Correct |
4 ms |
4948 KB |
Output is correct |
74 |
Correct |
3 ms |
4948 KB |
Output is correct |
75 |
Correct |
3 ms |
4996 KB |
Output is correct |
76 |
Correct |
3 ms |
4948 KB |
Output is correct |
77 |
Correct |
3 ms |
4996 KB |
Output is correct |
78 |
Correct |
3 ms |
4948 KB |
Output is correct |
79 |
Correct |
3 ms |
4948 KB |
Output is correct |
80 |
Correct |
3 ms |
5000 KB |
Output is correct |
81 |
Correct |
3 ms |
5008 KB |
Output is correct |
82 |
Correct |
3 ms |
5076 KB |
Output is correct |
83 |
Correct |
3 ms |
5008 KB |
Output is correct |
84 |
Correct |
3 ms |
4948 KB |
Output is correct |
85 |
Correct |
3 ms |
5076 KB |
Output is correct |
86 |
Correct |
3 ms |
5004 KB |
Output is correct |
87 |
Correct |
3 ms |
5004 KB |
Output is correct |
88 |
Correct |
3 ms |
4948 KB |
Output is correct |
89 |
Correct |
4 ms |
4948 KB |
Output is correct |
90 |
Correct |
3 ms |
5076 KB |
Output is correct |
91 |
Correct |
4 ms |
5076 KB |
Output is correct |
92 |
Correct |
4 ms |
5076 KB |
Output is correct |
93 |
Correct |
3 ms |
5004 KB |
Output is correct |
94 |
Correct |
3 ms |
4948 KB |
Output is correct |
95 |
Correct |
3 ms |
5004 KB |
Output is correct |
96 |
Correct |
3 ms |
5076 KB |
Output is correct |
97 |
Correct |
3 ms |
4948 KB |
Output is correct |
98 |
Correct |
3 ms |
5076 KB |
Output is correct |
99 |
Correct |
3 ms |
5076 KB |
Output is correct |
100 |
Correct |
3 ms |
5076 KB |
Output is correct |
101 |
Correct |
3 ms |
5076 KB |
Output is correct |
102 |
Correct |
3 ms |
5076 KB |
Output is correct |
103 |
Correct |
3 ms |
5076 KB |
Output is correct |
104 |
Correct |
3 ms |
4948 KB |
Output is correct |
105 |
Correct |
3 ms |
5088 KB |
Output is correct |
106 |
Correct |
4 ms |
5076 KB |
Output is correct |
107 |
Correct |
4 ms |
5204 KB |
Output is correct |
108 |
Correct |
4 ms |
5076 KB |
Output is correct |
109 |
Correct |
4 ms |
5204 KB |
Output is correct |
110 |
Correct |
4 ms |
5204 KB |
Output is correct |
111 |
Correct |
3 ms |
5260 KB |
Output is correct |
112 |
Correct |
5 ms |
5260 KB |
Output is correct |
113 |
Correct |
4 ms |
5272 KB |
Output is correct |
114 |
Correct |
7 ms |
5268 KB |
Output is correct |
115 |
Correct |
3 ms |
5204 KB |
Output is correct |
116 |
Correct |
4 ms |
5268 KB |
Output is correct |
117 |
Correct |
6 ms |
5192 KB |
Output is correct |
118 |
Correct |
31 ms |
8544 KB |
Output is correct |
119 |
Correct |
18 ms |
8984 KB |
Output is correct |
120 |
Correct |
24 ms |
9480 KB |
Output is correct |
121 |
Correct |
5 ms |
5460 KB |
Output is correct |
122 |
Correct |
4 ms |
5460 KB |
Output is correct |
123 |
Correct |
4 ms |
5512 KB |
Output is correct |
124 |
Correct |
5 ms |
5460 KB |
Output is correct |
125 |
Correct |
4 ms |
5516 KB |
Output is correct |
126 |
Correct |
5 ms |
5332 KB |
Output is correct |
127 |
Correct |
5 ms |
5332 KB |
Output is correct |
128 |
Correct |
5 ms |
5332 KB |
Output is correct |
129 |
Correct |
5 ms |
5396 KB |
Output is correct |
130 |
Correct |
5 ms |
5332 KB |
Output is correct |
131 |
Correct |
4 ms |
5332 KB |
Output is correct |
132 |
Correct |
26 ms |
9804 KB |
Output is correct |
133 |
Correct |
31 ms |
9852 KB |
Output is correct |
134 |
Correct |
62 ms |
9796 KB |
Output is correct |
135 |
Correct |
6 ms |
5972 KB |
Output is correct |
136 |
Correct |
101 ms |
63652 KB |
Output is correct |
137 |
Correct |
68 ms |
30128 KB |
Output is correct |
138 |
Correct |
63 ms |
28540 KB |
Output is correct |
139 |
Correct |
81 ms |
36360 KB |
Output is correct |
140 |
Correct |
54 ms |
20508 KB |
Output is correct |
141 |
Correct |
15 ms |
7380 KB |
Output is correct |
142 |
Correct |
15 ms |
7240 KB |
Output is correct |
143 |
Correct |
19 ms |
7800 KB |
Output is correct |
144 |
Correct |
17 ms |
7228 KB |
Output is correct |
145 |
Correct |
16 ms |
7648 KB |
Output is correct |
146 |
Correct |
19 ms |
7020 KB |
Output is correct |
147 |
Correct |
21 ms |
8360 KB |
Output is correct |
148 |
Correct |
7 ms |
6164 KB |
Output is correct |
149 |
Correct |
21 ms |
8596 KB |
Output is correct |
150 |
Correct |
8 ms |
5972 KB |
Output is correct |
151 |
Correct |
28 ms |
9292 KB |
Output is correct |
152 |
Correct |
9 ms |
6612 KB |
Output is correct |
153 |
Correct |
12 ms |
6660 KB |
Output is correct |
154 |
Correct |
11 ms |
7084 KB |
Output is correct |
155 |
Correct |
11 ms |
6484 KB |
Output is correct |
156 |
Correct |
11 ms |
6484 KB |
Output is correct |
157 |
Correct |
6 ms |
5972 KB |
Output is correct |
158 |
Correct |
139 ms |
85852 KB |
Output is correct |
159 |
Correct |
124 ms |
45796 KB |
Output is correct |
160 |
Correct |
120 ms |
45836 KB |
Output is correct |
161 |
Correct |
113 ms |
45836 KB |
Output is correct |
162 |
Correct |
119 ms |
41884 KB |
Output is correct |
163 |
Correct |
30 ms |
8012 KB |
Output is correct |
164 |
Correct |
27 ms |
8124 KB |
Output is correct |
165 |
Correct |
24 ms |
8012 KB |
Output is correct |
166 |
Correct |
21 ms |
8128 KB |
Output is correct |
167 |
Correct |
21 ms |
8032 KB |
Output is correct |
168 |
Correct |
20 ms |
8140 KB |
Output is correct |
169 |
Correct |
28 ms |
10124 KB |
Output is correct |
170 |
Correct |
11 ms |
6936 KB |
Output is correct |
171 |
Correct |
33 ms |
10056 KB |
Output is correct |
172 |
Correct |
13 ms |
6996 KB |
Output is correct |
173 |
Correct |
32 ms |
10152 KB |
Output is correct |
174 |
Correct |
10 ms |
6996 KB |
Output is correct |
175 |
Correct |
13 ms |
7492 KB |
Output is correct |
176 |
Correct |
12 ms |
7360 KB |
Output is correct |
177 |
Correct |
11 ms |
7248 KB |
Output is correct |
178 |
Correct |
12 ms |
7124 KB |
Output is correct |
179 |
Correct |
12 ms |
8020 KB |
Output is correct |
180 |
Correct |
288 ms |
111032 KB |
Output is correct |
181 |
Correct |
398 ms |
158296 KB |
Output is correct |
182 |
Correct |
568 ms |
207020 KB |
Output is correct |
183 |
Correct |
330 ms |
104888 KB |
Output is correct |
184 |
Correct |
301 ms |
69756 KB |
Output is correct |
185 |
Correct |
30 ms |
10956 KB |
Output is correct |
186 |
Correct |
30 ms |
13600 KB |
Output is correct |
187 |
Correct |
40 ms |
12108 KB |
Output is correct |
188 |
Correct |
32 ms |
9364 KB |
Output is correct |
189 |
Correct |
50 ms |
12340 KB |
Output is correct |
190 |
Correct |
41 ms |
11024 KB |
Output is correct |
191 |
Correct |
46 ms |
13392 KB |
Output is correct |
192 |
Correct |
23 ms |
8616 KB |
Output is correct |
193 |
Correct |
29 ms |
10412 KB |
Output is correct |
194 |
Correct |
21 ms |
9720 KB |
Output is correct |
195 |
Correct |
776 ms |
408928 KB |
Output is correct |
196 |
Correct |
672 ms |
208820 KB |
Output is correct |
197 |
Correct |
695 ms |
208912 KB |
Output is correct |
198 |
Correct |
625 ms |
208872 KB |
Output is correct |
199 |
Correct |
631 ms |
189004 KB |
Output is correct |
200 |
Correct |
108 ms |
23420 KB |
Output is correct |
201 |
Correct |
99 ms |
23320 KB |
Output is correct |
202 |
Correct |
89 ms |
23384 KB |
Output is correct |
203 |
Correct |
81 ms |
23436 KB |
Output is correct |
204 |
Correct |
95 ms |
23432 KB |
Output is correct |
205 |
Correct |
109 ms |
23436 KB |
Output is correct |
206 |
Correct |
67 ms |
18748 KB |
Output is correct |
207 |
Correct |
76 ms |
21704 KB |
Output is correct |
208 |
Correct |
83 ms |
18680 KB |
Output is correct |
209 |
Correct |
101 ms |
21656 KB |
Output is correct |
210 |
Correct |
66 ms |
18680 KB |
Output is correct |
211 |
Correct |
68 ms |
21704 KB |
Output is correct |
212 |
Correct |
74 ms |
23116 KB |
Output is correct |
213 |
Correct |
87 ms |
18692 KB |
Output is correct |
214 |
Correct |
96 ms |
17944 KB |
Output is correct |
215 |
Correct |
70 ms |
17668 KB |
Output is correct |