#include "paint.h"
#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;
typedef int ll;
typedef vector<ll> vi;
typedef vector<vector<ll>> vvi;
typedef pair<ll,ll> pi;
typedef map<ll,ll> mi;
typedef long double ld;
typedef vector<ld> vd;
typedef vector<vector<ld>> vvd;
typedef pair<ld,ld> pd;
#define ff first
#define ss second
#define srt(a) sort(a.begin(),a.end());
#define fip(k, n) for (ll i = k; i < n; i++)
#define fjp(k, n) for (ll j = k; j < n; j++)
#define fin(k, n) for (ll i = k; i >= n; i--)
#define fjn(k, n) for (ll j = k; j >= n; j--)
#define fp(k, n, m) for (ll k = n; k < m; k++)
#define fn(k, n, m) for (ll k = n; k >= m; k--)
#define ordered_set tree<pi, null_type,less< pi >, rb_tree_tag,tree_order_statistics_node_update>
#define totalOne(n) __builtin_popcount(n)
#define backZero(n) __builtin_ctzll(n)
#define frontZero(n) __builtin_clzll(n)
#define fx(k) for ( auto x : k )
#define test ll t;cin >> t;while (t--)
#define nli "\n"
// ==========================(debug)============================================================================================== //
#ifndef ONLINE_JUDGE
#define debug(x) cerr << #x <<" "; _printn(x); cerr << nli;
#else
#define debug(x)
#endif
// void _printn(ll x){ cerr<<x<<" "; }
void _printn(int x){ cerr<<x<<" "; }
void _printn(ld x){ cerr<<x<<" "; }
void _printn(double x){ cerr<<x<<" "; }
void _printn(string x){ cerr<<x<<" "; }
void _printn(char x){ cerr<<x<<" "; }
void _printn(bool x){ cerr<<x<<" "; }
template<class T,class V>void _printn(pair<T,V> vv);
template<class T> void _printn(vector<T> vv);
template<class T> void _printn(set<T> vv);
template<class T,class V> void _printn(map<T,V> vv);
template<class T> void _printn(multiset<T> vv);
template<class T,class V>void _printn(pair<T,V> vv){ cerr<<"( ";_printn(vv.ff);cerr<<",";_printn(vv.ss);cerr<<")";}
template<class T> void _printn(vector<T> vv){ cerr<<"[ "; for(auto xx:vv){ _printn(xx);cerr<<" "; } cerr<<"]"; };
template<class T> void _printn(set<T> vv){ cerr<<"{ "; for(auto xx:vv){ _printn(xx);cerr<<" "; } cerr<<"}"; };
template<class T> void _printn(multiset<T> vv){ cerr<<"{ "; for(auto xx:vv){ _printn(xx);cerr<<" "; } cerr<<"}"; };
template<class T,class V> void _printn(map<T,V> vv){ cerr<<"{ "; for(auto xx:vv){ _printn(xx);cerr<<" "; } cerr<<"}"; };
// ==========================(debug)============================================================================================== //
ll n,m,tp,tp2,res,cnt,sum,tptp,ans;
const ll mx = 1e5+5;
const ll mx2 = 5e4+5;
const ll mod = 1e9+7;
// // ==========================(MOD)=============================================================================================== //
// ll mod_add(ll aa,ll bb){ return ((aa%mod)+(bb%mod))%mod; }
// ll mod_minus(ll aa,ll bb){ return (((aa%mod)-(bb%mod))+10*mod)%mod; }
// ll mod_mul(ll aa,ll bb){ return ((aa%mod)*(bb%mod))%mod; }
// ll mod_power(ll aa,ll bb){ aa%=mod; ll empowered = 1; bb%=mod-1; while(bb > 0){ if(bb & 1) empowered = mod_mul(empowered,aa); bb = bb >> 1; aa = mod_mul(aa,aa); } return empowered; }
// ll mod_divi(ll aa,ll bb){ aa=mod_mul(aa,mod_power(bb,mod-2)); return aa; }
// // ==========================(MOD)=============================================================================================== //
bool f = false;
vi color[mx];
ll dp[mx];
vi mark[mx2];
bool possible[mx];
vector<pi> v;
ll calc(ll a,ll i){
return ((((a - i) % m) + m) % m);
}
typedef struct SEGMENT_TREE{
vi arr;
ll range;
void init(ll k){
range = log2(k);
range = 1 << (range + 3);
arr.resize(range,1e9);
return ;
}
ll construct(ll ptr,ll l,ll r){
if(l==r){
arr[ptr] = 1e9;
return arr[ptr];
}
ll mid = l + (r-l)/2;
arr[ptr] = min(construct(2*ptr,l,mid),construct(2*ptr+1,mid+1,r));
return arr[ptr];
}
ll query(ll ptr,ll l,ll r,ll st,ll en){
if(l>en || r<st)
return 1e9;
if(l>=st && r<=en)
return arr[ptr];
ll mid = l + (r-l)/2;
return min(query(2*ptr,l,mid,st,en),query(2*ptr+1,mid+1,r,st,en));
}
ll update(ll ptr,ll l,ll r,ll value,ll pos){
if(l==r && l==pos){
arr[ptr] = value;
return arr[ptr];
}
if(l>pos || r<pos)
return arr[ptr];
ll mid = l + (r-l)/2;
arr[ptr] = min(update(2*ptr,l,mid,value,pos),update(2*ptr+1,mid+1,r,value,pos));
return arr[ptr];
}
}SGT;
SGT sgt;
int minimumInstructions(int N, int M, int K,vector<int> C,vector<int> A,vector<vector<int>> B) {
memset(possible,false,sizeof(possible));
n = N,m = M,tp = K;
fip(0,m){
fx(B[i]){
color[x].push_back(i);
}
}
fip(0,n){
fx(color[C[i]]){
mark[calc(x,i)].push_back(i);
}
}
fip(0,m){
tp = mark[i].size();
for(ll j = 0; j + m - 1 < tp ; j++){
if(mark[i][j]+m-1 == mark[i][j+m-1])
possible[mark[i][j]] = 1;
}
}
fip(0,n-m+1){
if(possible[i])
v.push_back({i,i+m-1});
}
fip(0,n+1){
dp[i] = 1e9;
}
srt(v);
sgt.init(n);
sgt.construct(1,0,n-1);
fx(v){
ll l = x.ff;
ll r = x.ss;
if(l==0)
dp[r] = 1;
else
dp[r] = min(dp[r],sgt.query(1,0,n-1,l-1,r)+1);
sgt.update(1,0,n-1,dp[r],r);
}
// cout<<"OK";
if(dp[n-1]>n)
return -1;
else return dp[n-1];
}
// int main(){
// ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
// #ifndef ONLINE_JUDGE
// freopen("input1.txt", "r", stdin);
// freopen("output1.txt", "w", stdout);
// freopen("error1.txt", "w", stderr);
// #endif // ONLINE_JUDGE
// int N,M,K;
// cin>>N>>M>>K;
// vector<int> C,A;
// vector<vector<int>> B(M);
// fip(0,N){
// cin>>tp;
// C.push_back(tp);
// }
// fip(0,M){
// cin>>tp;
// A.push_back(tp);
// // cin>>tp;
// // debug(tp);
// fjp(0,tp){
// cin>>tp2;
// // debug(tp2);
// B[i].push_back(tp2);
// // debug(B[i]);
// }
// }
// cout<<minimumInstructions(N,M,K,C,A,B);
// cerr << "Time elapsed: " << setprecision(6) << 1000.0 * clock() / CLOCKS_PER_SEC << "ms\n";
// return 0;
// }
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
3924 KB |
Output is correct |
2 |
Correct |
2 ms |
3832 KB |
Output is correct |
3 |
Correct |
2 ms |
3924 KB |
Output is correct |
4 |
Correct |
2 ms |
3924 KB |
Output is correct |
5 |
Correct |
2 ms |
3924 KB |
Output is correct |
6 |
Correct |
3 ms |
3924 KB |
Output is correct |
7 |
Correct |
3 ms |
3924 KB |
Output is correct |
8 |
Correct |
3 ms |
3924 KB |
Output is correct |
9 |
Correct |
3 ms |
3924 KB |
Output is correct |
10 |
Correct |
2 ms |
3832 KB |
Output is correct |
11 |
Correct |
2 ms |
3924 KB |
Output is correct |
12 |
Correct |
4 ms |
3876 KB |
Output is correct |
13 |
Correct |
2 ms |
3960 KB |
Output is correct |
14 |
Correct |
3 ms |
3924 KB |
Output is correct |
15 |
Correct |
3 ms |
3964 KB |
Output is correct |
16 |
Correct |
2 ms |
3960 KB |
Output is correct |
17 |
Correct |
3 ms |
3924 KB |
Output is correct |
18 |
Correct |
3 ms |
3960 KB |
Output is correct |
19 |
Correct |
2 ms |
3924 KB |
Output is correct |
20 |
Correct |
3 ms |
3924 KB |
Output is correct |
21 |
Correct |
2 ms |
3964 KB |
Output is correct |
22 |
Correct |
20 ms |
8380 KB |
Output is correct |
23 |
Correct |
18 ms |
8376 KB |
Output is correct |
24 |
Correct |
18 ms |
8324 KB |
Output is correct |
25 |
Correct |
9 ms |
4992 KB |
Output is correct |
26 |
Correct |
9 ms |
4988 KB |
Output is correct |
27 |
Correct |
8 ms |
5076 KB |
Output is correct |
28 |
Correct |
6 ms |
4868 KB |
Output is correct |
29 |
Correct |
7 ms |
4868 KB |
Output is correct |
30 |
Correct |
5 ms |
4740 KB |
Output is correct |
31 |
Correct |
15 ms |
6196 KB |
Output is correct |
32 |
Correct |
15 ms |
6084 KB |
Output is correct |
33 |
Correct |
16 ms |
6096 KB |
Output is correct |
34 |
Correct |
15 ms |
6096 KB |
Output is correct |
35 |
Correct |
15 ms |
6144 KB |
Output is correct |
36 |
Correct |
15 ms |
6096 KB |
Output is correct |
37 |
Correct |
23 ms |
9548 KB |
Output is correct |
38 |
Correct |
26 ms |
9544 KB |
Output is correct |
39 |
Correct |
23 ms |
9560 KB |
Output is correct |
40 |
Correct |
37 ms |
8420 KB |
Output is correct |
41 |
Correct |
24 ms |
6484 KB |
Output is correct |
42 |
Correct |
29 ms |
8248 KB |
Output is correct |
43 |
Correct |
13 ms |
6184 KB |
Output is correct |
44 |
Correct |
10 ms |
6100 KB |
Output is correct |
45 |
Correct |
15 ms |
7988 KB |
Output is correct |
46 |
Correct |
52 ms |
17208 KB |
Output is correct |
47 |
Correct |
36 ms |
11448 KB |
Output is correct |
48 |
Correct |
32 ms |
13772 KB |
Output is correct |
49 |
Correct |
45 ms |
14716 KB |
Output is correct |
50 |
Correct |
45 ms |
15488 KB |
Output is correct |
51 |
Correct |
36 ms |
12960 KB |
Output is correct |
52 |
Correct |
41 ms |
8736 KB |
Output is correct |
53 |
Correct |
40 ms |
8548 KB |
Output is correct |
54 |
Correct |
29 ms |
8176 KB |
Output is correct |
55 |
Correct |
19 ms |
7892 KB |
Output is correct |
56 |
Correct |
16 ms |
7832 KB |
Output is correct |
57 |
Correct |
15 ms |
8008 KB |
Output is correct |
58 |
Correct |
66 ms |
18304 KB |
Output is correct |
59 |
Correct |
61 ms |
18244 KB |
Output is correct |
60 |
Correct |
65 ms |
18312 KB |
Output is correct |
61 |
Correct |
59 ms |
18244 KB |
Output is correct |
62 |
Correct |
77 ms |
18284 KB |
Output is correct |
63 |
Correct |
60 ms |
18312 KB |
Output is correct |
64 |
Correct |
77 ms |
17772 KB |
Output is correct |
65 |
Correct |
59 ms |
17804 KB |
Output is correct |
66 |
Correct |
59 ms |
17956 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
3924 KB |
Output is correct |
2 |
Correct |
2 ms |
3832 KB |
Output is correct |
3 |
Correct |
2 ms |
3924 KB |
Output is correct |
4 |
Correct |
2 ms |
3924 KB |
Output is correct |
5 |
Correct |
2 ms |
3924 KB |
Output is correct |
6 |
Correct |
3 ms |
3924 KB |
Output is correct |
7 |
Correct |
3 ms |
3924 KB |
Output is correct |
8 |
Correct |
3 ms |
3924 KB |
Output is correct |
9 |
Correct |
3 ms |
3924 KB |
Output is correct |
10 |
Correct |
2 ms |
3832 KB |
Output is correct |
11 |
Correct |
2 ms |
3924 KB |
Output is correct |
12 |
Correct |
4 ms |
3876 KB |
Output is correct |
13 |
Correct |
2 ms |
3960 KB |
Output is correct |
14 |
Correct |
3 ms |
3924 KB |
Output is correct |
15 |
Correct |
3 ms |
3964 KB |
Output is correct |
16 |
Correct |
2 ms |
3960 KB |
Output is correct |
17 |
Correct |
3 ms |
3924 KB |
Output is correct |
18 |
Correct |
3 ms |
3960 KB |
Output is correct |
19 |
Correct |
2 ms |
3924 KB |
Output is correct |
20 |
Correct |
3 ms |
3924 KB |
Output is correct |
21 |
Correct |
2 ms |
3964 KB |
Output is correct |
22 |
Correct |
2 ms |
3828 KB |
Output is correct |
23 |
Correct |
3 ms |
3924 KB |
Output is correct |
24 |
Correct |
2 ms |
3924 KB |
Output is correct |
25 |
Correct |
2 ms |
3924 KB |
Output is correct |
26 |
Correct |
2 ms |
3924 KB |
Output is correct |
27 |
Correct |
3 ms |
3924 KB |
Output is correct |
28 |
Correct |
3 ms |
3924 KB |
Output is correct |
29 |
Correct |
2 ms |
3924 KB |
Output is correct |
30 |
Correct |
2 ms |
3980 KB |
Output is correct |
31 |
Correct |
3 ms |
3924 KB |
Output is correct |
32 |
Correct |
2 ms |
3924 KB |
Output is correct |
33 |
Correct |
3 ms |
3964 KB |
Output is correct |
34 |
Correct |
3 ms |
3924 KB |
Output is correct |
35 |
Correct |
3 ms |
3924 KB |
Output is correct |
36 |
Correct |
2 ms |
3924 KB |
Output is correct |
37 |
Correct |
3 ms |
3924 KB |
Output is correct |
38 |
Correct |
4 ms |
3924 KB |
Output is correct |
39 |
Correct |
3 ms |
3956 KB |
Output is correct |
40 |
Correct |
3 ms |
3964 KB |
Output is correct |
41 |
Correct |
2 ms |
3960 KB |
Output is correct |
42 |
Correct |
3 ms |
3964 KB |
Output is correct |
43 |
Correct |
2 ms |
3924 KB |
Output is correct |
44 |
Correct |
3 ms |
3924 KB |
Output is correct |
45 |
Correct |
3 ms |
3960 KB |
Output is correct |
46 |
Correct |
2 ms |
3924 KB |
Output is correct |
47 |
Correct |
3 ms |
3972 KB |
Output is correct |
48 |
Correct |
3 ms |
3924 KB |
Output is correct |
49 |
Correct |
2 ms |
3924 KB |
Output is correct |
50 |
Correct |
3 ms |
3964 KB |
Output is correct |
51 |
Correct |
2 ms |
3924 KB |
Output is correct |
52 |
Correct |
3 ms |
3924 KB |
Output is correct |
53 |
Correct |
3 ms |
3964 KB |
Output is correct |
54 |
Correct |
3 ms |
4052 KB |
Output is correct |
55 |
Correct |
3 ms |
4052 KB |
Output is correct |
56 |
Correct |
2 ms |
3924 KB |
Output is correct |
57 |
Correct |
2 ms |
3924 KB |
Output is correct |
58 |
Correct |
2 ms |
3972 KB |
Output is correct |
59 |
Correct |
3 ms |
3924 KB |
Output is correct |
60 |
Correct |
2 ms |
3972 KB |
Output is correct |
61 |
Correct |
3 ms |
3940 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3828 KB |
Output is correct |
2 |
Correct |
3 ms |
3924 KB |
Output is correct |
3 |
Correct |
3 ms |
3924 KB |
Output is correct |
4 |
Correct |
2 ms |
3832 KB |
Output is correct |
5 |
Correct |
2 ms |
3924 KB |
Output is correct |
6 |
Correct |
2 ms |
3924 KB |
Output is correct |
7 |
Correct |
2 ms |
3924 KB |
Output is correct |
8 |
Correct |
3 ms |
3924 KB |
Output is correct |
9 |
Correct |
3 ms |
3924 KB |
Output is correct |
10 |
Correct |
3 ms |
3924 KB |
Output is correct |
11 |
Correct |
3 ms |
3924 KB |
Output is correct |
12 |
Correct |
2 ms |
3832 KB |
Output is correct |
13 |
Correct |
2 ms |
3924 KB |
Output is correct |
14 |
Correct |
4 ms |
3876 KB |
Output is correct |
15 |
Correct |
2 ms |
3960 KB |
Output is correct |
16 |
Correct |
3 ms |
3924 KB |
Output is correct |
17 |
Correct |
3 ms |
3964 KB |
Output is correct |
18 |
Correct |
2 ms |
3960 KB |
Output is correct |
19 |
Correct |
3 ms |
3924 KB |
Output is correct |
20 |
Correct |
3 ms |
3960 KB |
Output is correct |
21 |
Correct |
2 ms |
3924 KB |
Output is correct |
22 |
Correct |
3 ms |
3924 KB |
Output is correct |
23 |
Correct |
2 ms |
3964 KB |
Output is correct |
24 |
Correct |
20 ms |
8380 KB |
Output is correct |
25 |
Correct |
18 ms |
8376 KB |
Output is correct |
26 |
Correct |
18 ms |
8324 KB |
Output is correct |
27 |
Correct |
2 ms |
3924 KB |
Output is correct |
28 |
Correct |
2 ms |
3924 KB |
Output is correct |
29 |
Correct |
2 ms |
3924 KB |
Output is correct |
30 |
Correct |
3 ms |
3924 KB |
Output is correct |
31 |
Correct |
3 ms |
3924 KB |
Output is correct |
32 |
Correct |
2 ms |
3924 KB |
Output is correct |
33 |
Correct |
2 ms |
3980 KB |
Output is correct |
34 |
Correct |
3 ms |
3924 KB |
Output is correct |
35 |
Correct |
2 ms |
3924 KB |
Output is correct |
36 |
Correct |
3 ms |
3964 KB |
Output is correct |
37 |
Correct |
3 ms |
3924 KB |
Output is correct |
38 |
Correct |
3 ms |
3924 KB |
Output is correct |
39 |
Correct |
2 ms |
3924 KB |
Output is correct |
40 |
Correct |
3 ms |
3924 KB |
Output is correct |
41 |
Correct |
4 ms |
3924 KB |
Output is correct |
42 |
Correct |
3 ms |
3956 KB |
Output is correct |
43 |
Correct |
3 ms |
3964 KB |
Output is correct |
44 |
Correct |
2 ms |
3960 KB |
Output is correct |
45 |
Correct |
3 ms |
3964 KB |
Output is correct |
46 |
Correct |
2 ms |
3924 KB |
Output is correct |
47 |
Correct |
3 ms |
3924 KB |
Output is correct |
48 |
Correct |
3 ms |
3960 KB |
Output is correct |
49 |
Correct |
2 ms |
3924 KB |
Output is correct |
50 |
Correct |
3 ms |
3972 KB |
Output is correct |
51 |
Correct |
3 ms |
3924 KB |
Output is correct |
52 |
Correct |
2 ms |
3924 KB |
Output is correct |
53 |
Correct |
3 ms |
3964 KB |
Output is correct |
54 |
Correct |
2 ms |
3924 KB |
Output is correct |
55 |
Correct |
3 ms |
3924 KB |
Output is correct |
56 |
Correct |
3 ms |
3964 KB |
Output is correct |
57 |
Correct |
3 ms |
4052 KB |
Output is correct |
58 |
Correct |
3 ms |
4052 KB |
Output is correct |
59 |
Correct |
2 ms |
3924 KB |
Output is correct |
60 |
Correct |
2 ms |
3924 KB |
Output is correct |
61 |
Correct |
2 ms |
3972 KB |
Output is correct |
62 |
Correct |
3 ms |
3924 KB |
Output is correct |
63 |
Correct |
2 ms |
3972 KB |
Output is correct |
64 |
Correct |
3 ms |
3940 KB |
Output is correct |
65 |
Correct |
3 ms |
4088 KB |
Output is correct |
66 |
Correct |
3 ms |
4052 KB |
Output is correct |
67 |
Correct |
4 ms |
4244 KB |
Output is correct |
68 |
Correct |
3 ms |
4076 KB |
Output is correct |
69 |
Correct |
4 ms |
4180 KB |
Output is correct |
70 |
Correct |
4 ms |
4244 KB |
Output is correct |
71 |
Correct |
4 ms |
4180 KB |
Output is correct |
72 |
Correct |
4 ms |
4224 KB |
Output is correct |
73 |
Correct |
3 ms |
4052 KB |
Output is correct |
74 |
Correct |
4 ms |
4228 KB |
Output is correct |
75 |
Correct |
3 ms |
4180 KB |
Output is correct |
76 |
Correct |
22 ms |
7224 KB |
Output is correct |
77 |
Correct |
18 ms |
7712 KB |
Output is correct |
78 |
Correct |
33 ms |
8192 KB |
Output is correct |
79 |
Correct |
4 ms |
4308 KB |
Output is correct |
80 |
Correct |
5 ms |
4316 KB |
Output is correct |
81 |
Correct |
5 ms |
4344 KB |
Output is correct |
82 |
Correct |
4 ms |
4308 KB |
Output is correct |
83 |
Correct |
5 ms |
4308 KB |
Output is correct |
84 |
Correct |
4 ms |
4308 KB |
Output is correct |
85 |
Correct |
4 ms |
4308 KB |
Output is correct |
86 |
Correct |
5 ms |
4224 KB |
Output is correct |
87 |
Correct |
4 ms |
4220 KB |
Output is correct |
88 |
Correct |
4 ms |
4200 KB |
Output is correct |
89 |
Correct |
4 ms |
4308 KB |
Output is correct |
90 |
Correct |
28 ms |
8524 KB |
Output is correct |
91 |
Correct |
28 ms |
8652 KB |
Output is correct |
92 |
Correct |
27 ms |
8544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3828 KB |
Output is correct |
2 |
Correct |
3 ms |
3924 KB |
Output is correct |
3 |
Correct |
3 ms |
3924 KB |
Output is correct |
4 |
Correct |
2 ms |
3832 KB |
Output is correct |
5 |
Correct |
2 ms |
3924 KB |
Output is correct |
6 |
Correct |
2 ms |
3924 KB |
Output is correct |
7 |
Correct |
2 ms |
3924 KB |
Output is correct |
8 |
Correct |
3 ms |
3924 KB |
Output is correct |
9 |
Correct |
3 ms |
3924 KB |
Output is correct |
10 |
Correct |
3 ms |
3924 KB |
Output is correct |
11 |
Correct |
3 ms |
3924 KB |
Output is correct |
12 |
Correct |
2 ms |
3832 KB |
Output is correct |
13 |
Correct |
2 ms |
3924 KB |
Output is correct |
14 |
Correct |
4 ms |
3876 KB |
Output is correct |
15 |
Correct |
2 ms |
3960 KB |
Output is correct |
16 |
Correct |
3 ms |
3924 KB |
Output is correct |
17 |
Correct |
3 ms |
3964 KB |
Output is correct |
18 |
Correct |
2 ms |
3960 KB |
Output is correct |
19 |
Correct |
3 ms |
3924 KB |
Output is correct |
20 |
Correct |
3 ms |
3960 KB |
Output is correct |
21 |
Correct |
2 ms |
3924 KB |
Output is correct |
22 |
Correct |
3 ms |
3924 KB |
Output is correct |
23 |
Correct |
2 ms |
3964 KB |
Output is correct |
24 |
Correct |
20 ms |
8380 KB |
Output is correct |
25 |
Correct |
18 ms |
8376 KB |
Output is correct |
26 |
Correct |
18 ms |
8324 KB |
Output is correct |
27 |
Correct |
9 ms |
4992 KB |
Output is correct |
28 |
Correct |
9 ms |
4988 KB |
Output is correct |
29 |
Correct |
8 ms |
5076 KB |
Output is correct |
30 |
Correct |
6 ms |
4868 KB |
Output is correct |
31 |
Correct |
7 ms |
4868 KB |
Output is correct |
32 |
Correct |
5 ms |
4740 KB |
Output is correct |
33 |
Correct |
15 ms |
6196 KB |
Output is correct |
34 |
Correct |
15 ms |
6084 KB |
Output is correct |
35 |
Correct |
16 ms |
6096 KB |
Output is correct |
36 |
Correct |
15 ms |
6096 KB |
Output is correct |
37 |
Correct |
15 ms |
6144 KB |
Output is correct |
38 |
Correct |
15 ms |
6096 KB |
Output is correct |
39 |
Correct |
23 ms |
9548 KB |
Output is correct |
40 |
Correct |
26 ms |
9544 KB |
Output is correct |
41 |
Correct |
23 ms |
9560 KB |
Output is correct |
42 |
Correct |
2 ms |
3924 KB |
Output is correct |
43 |
Correct |
2 ms |
3924 KB |
Output is correct |
44 |
Correct |
2 ms |
3924 KB |
Output is correct |
45 |
Correct |
3 ms |
3924 KB |
Output is correct |
46 |
Correct |
3 ms |
3924 KB |
Output is correct |
47 |
Correct |
2 ms |
3924 KB |
Output is correct |
48 |
Correct |
2 ms |
3980 KB |
Output is correct |
49 |
Correct |
3 ms |
3924 KB |
Output is correct |
50 |
Correct |
2 ms |
3924 KB |
Output is correct |
51 |
Correct |
3 ms |
3964 KB |
Output is correct |
52 |
Correct |
3 ms |
3924 KB |
Output is correct |
53 |
Correct |
3 ms |
3924 KB |
Output is correct |
54 |
Correct |
2 ms |
3924 KB |
Output is correct |
55 |
Correct |
3 ms |
3924 KB |
Output is correct |
56 |
Correct |
4 ms |
3924 KB |
Output is correct |
57 |
Correct |
3 ms |
3956 KB |
Output is correct |
58 |
Correct |
3 ms |
3964 KB |
Output is correct |
59 |
Correct |
2 ms |
3960 KB |
Output is correct |
60 |
Correct |
3 ms |
3964 KB |
Output is correct |
61 |
Correct |
2 ms |
3924 KB |
Output is correct |
62 |
Correct |
3 ms |
3924 KB |
Output is correct |
63 |
Correct |
3 ms |
3960 KB |
Output is correct |
64 |
Correct |
2 ms |
3924 KB |
Output is correct |
65 |
Correct |
3 ms |
3972 KB |
Output is correct |
66 |
Correct |
3 ms |
3924 KB |
Output is correct |
67 |
Correct |
2 ms |
3924 KB |
Output is correct |
68 |
Correct |
3 ms |
3964 KB |
Output is correct |
69 |
Correct |
2 ms |
3924 KB |
Output is correct |
70 |
Correct |
3 ms |
3924 KB |
Output is correct |
71 |
Correct |
3 ms |
3964 KB |
Output is correct |
72 |
Correct |
3 ms |
4052 KB |
Output is correct |
73 |
Correct |
3 ms |
4052 KB |
Output is correct |
74 |
Correct |
2 ms |
3924 KB |
Output is correct |
75 |
Correct |
2 ms |
3924 KB |
Output is correct |
76 |
Correct |
2 ms |
3972 KB |
Output is correct |
77 |
Correct |
3 ms |
3924 KB |
Output is correct |
78 |
Correct |
2 ms |
3972 KB |
Output is correct |
79 |
Correct |
3 ms |
3940 KB |
Output is correct |
80 |
Correct |
3 ms |
4088 KB |
Output is correct |
81 |
Correct |
3 ms |
4052 KB |
Output is correct |
82 |
Correct |
4 ms |
4244 KB |
Output is correct |
83 |
Correct |
3 ms |
4076 KB |
Output is correct |
84 |
Correct |
4 ms |
4180 KB |
Output is correct |
85 |
Correct |
4 ms |
4244 KB |
Output is correct |
86 |
Correct |
4 ms |
4180 KB |
Output is correct |
87 |
Correct |
4 ms |
4224 KB |
Output is correct |
88 |
Correct |
3 ms |
4052 KB |
Output is correct |
89 |
Correct |
4 ms |
4228 KB |
Output is correct |
90 |
Correct |
3 ms |
4180 KB |
Output is correct |
91 |
Correct |
22 ms |
7224 KB |
Output is correct |
92 |
Correct |
18 ms |
7712 KB |
Output is correct |
93 |
Correct |
33 ms |
8192 KB |
Output is correct |
94 |
Correct |
4 ms |
4308 KB |
Output is correct |
95 |
Correct |
5 ms |
4316 KB |
Output is correct |
96 |
Correct |
5 ms |
4344 KB |
Output is correct |
97 |
Correct |
4 ms |
4308 KB |
Output is correct |
98 |
Correct |
5 ms |
4308 KB |
Output is correct |
99 |
Correct |
4 ms |
4308 KB |
Output is correct |
100 |
Correct |
4 ms |
4308 KB |
Output is correct |
101 |
Correct |
5 ms |
4224 KB |
Output is correct |
102 |
Correct |
4 ms |
4220 KB |
Output is correct |
103 |
Correct |
4 ms |
4200 KB |
Output is correct |
104 |
Correct |
4 ms |
4308 KB |
Output is correct |
105 |
Correct |
28 ms |
8524 KB |
Output is correct |
106 |
Correct |
28 ms |
8652 KB |
Output is correct |
107 |
Correct |
27 ms |
8544 KB |
Output is correct |
108 |
Correct |
9 ms |
5268 KB |
Output is correct |
109 |
Correct |
172 ms |
43596 KB |
Output is correct |
110 |
Correct |
86 ms |
26868 KB |
Output is correct |
111 |
Correct |
66 ms |
25380 KB |
Output is correct |
112 |
Correct |
76 ms |
27700 KB |
Output is correct |
113 |
Correct |
52 ms |
20764 KB |
Output is correct |
114 |
Correct |
17 ms |
6344 KB |
Output is correct |
115 |
Correct |
16 ms |
6324 KB |
Output is correct |
116 |
Correct |
23 ms |
6992 KB |
Output is correct |
117 |
Correct |
16 ms |
6368 KB |
Output is correct |
118 |
Correct |
18 ms |
6484 KB |
Output is correct |
119 |
Correct |
17 ms |
6028 KB |
Output is correct |
120 |
Correct |
20 ms |
7452 KB |
Output is correct |
121 |
Correct |
9 ms |
5212 KB |
Output is correct |
122 |
Correct |
22 ms |
7744 KB |
Output is correct |
123 |
Correct |
9 ms |
5076 KB |
Output is correct |
124 |
Correct |
27 ms |
8656 KB |
Output is correct |
125 |
Correct |
14 ms |
5876 KB |
Output is correct |
126 |
Correct |
8 ms |
5404 KB |
Output is correct |
127 |
Correct |
10 ms |
5972 KB |
Output is correct |
128 |
Correct |
8 ms |
5252 KB |
Output is correct |
129 |
Correct |
8 ms |
5204 KB |
Output is correct |
130 |
Correct |
10 ms |
5300 KB |
Output is correct |
131 |
Correct |
251 ms |
71608 KB |
Output is correct |
132 |
Correct |
160 ms |
53836 KB |
Output is correct |
133 |
Correct |
128 ms |
37068 KB |
Output is correct |
134 |
Correct |
113 ms |
37928 KB |
Output is correct |
135 |
Correct |
109 ms |
37840 KB |
Output is correct |
136 |
Correct |
23 ms |
7196 KB |
Output is correct |
137 |
Correct |
25 ms |
7316 KB |
Output is correct |
138 |
Correct |
24 ms |
7212 KB |
Output is correct |
139 |
Correct |
23 ms |
7280 KB |
Output is correct |
140 |
Correct |
23 ms |
7268 KB |
Output is correct |
141 |
Correct |
23 ms |
7240 KB |
Output is correct |
142 |
Correct |
32 ms |
9772 KB |
Output is correct |
143 |
Correct |
16 ms |
6100 KB |
Output is correct |
144 |
Correct |
33 ms |
9804 KB |
Output is correct |
145 |
Correct |
15 ms |
6132 KB |
Output is correct |
146 |
Correct |
33 ms |
9756 KB |
Output is correct |
147 |
Correct |
15 ms |
6096 KB |
Output is correct |
148 |
Correct |
11 ms |
6100 KB |
Output is correct |
149 |
Correct |
12 ms |
6064 KB |
Output is correct |
150 |
Correct |
12 ms |
6020 KB |
Output is correct |
151 |
Correct |
10 ms |
5856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
3828 KB |
Output is correct |
2 |
Correct |
3 ms |
3924 KB |
Output is correct |
3 |
Correct |
3 ms |
3924 KB |
Output is correct |
4 |
Correct |
2 ms |
3832 KB |
Output is correct |
5 |
Correct |
2 ms |
3924 KB |
Output is correct |
6 |
Correct |
2 ms |
3924 KB |
Output is correct |
7 |
Correct |
2 ms |
3924 KB |
Output is correct |
8 |
Correct |
3 ms |
3924 KB |
Output is correct |
9 |
Correct |
3 ms |
3924 KB |
Output is correct |
10 |
Correct |
3 ms |
3924 KB |
Output is correct |
11 |
Correct |
3 ms |
3924 KB |
Output is correct |
12 |
Correct |
2 ms |
3832 KB |
Output is correct |
13 |
Correct |
2 ms |
3924 KB |
Output is correct |
14 |
Correct |
4 ms |
3876 KB |
Output is correct |
15 |
Correct |
2 ms |
3960 KB |
Output is correct |
16 |
Correct |
3 ms |
3924 KB |
Output is correct |
17 |
Correct |
3 ms |
3964 KB |
Output is correct |
18 |
Correct |
2 ms |
3960 KB |
Output is correct |
19 |
Correct |
3 ms |
3924 KB |
Output is correct |
20 |
Correct |
3 ms |
3960 KB |
Output is correct |
21 |
Correct |
2 ms |
3924 KB |
Output is correct |
22 |
Correct |
3 ms |
3924 KB |
Output is correct |
23 |
Correct |
2 ms |
3964 KB |
Output is correct |
24 |
Correct |
20 ms |
8380 KB |
Output is correct |
25 |
Correct |
18 ms |
8376 KB |
Output is correct |
26 |
Correct |
18 ms |
8324 KB |
Output is correct |
27 |
Correct |
9 ms |
4992 KB |
Output is correct |
28 |
Correct |
9 ms |
4988 KB |
Output is correct |
29 |
Correct |
8 ms |
5076 KB |
Output is correct |
30 |
Correct |
6 ms |
4868 KB |
Output is correct |
31 |
Correct |
7 ms |
4868 KB |
Output is correct |
32 |
Correct |
5 ms |
4740 KB |
Output is correct |
33 |
Correct |
15 ms |
6196 KB |
Output is correct |
34 |
Correct |
15 ms |
6084 KB |
Output is correct |
35 |
Correct |
16 ms |
6096 KB |
Output is correct |
36 |
Correct |
15 ms |
6096 KB |
Output is correct |
37 |
Correct |
15 ms |
6144 KB |
Output is correct |
38 |
Correct |
15 ms |
6096 KB |
Output is correct |
39 |
Correct |
23 ms |
9548 KB |
Output is correct |
40 |
Correct |
26 ms |
9544 KB |
Output is correct |
41 |
Correct |
23 ms |
9560 KB |
Output is correct |
42 |
Correct |
37 ms |
8420 KB |
Output is correct |
43 |
Correct |
24 ms |
6484 KB |
Output is correct |
44 |
Correct |
29 ms |
8248 KB |
Output is correct |
45 |
Correct |
13 ms |
6184 KB |
Output is correct |
46 |
Correct |
10 ms |
6100 KB |
Output is correct |
47 |
Correct |
15 ms |
7988 KB |
Output is correct |
48 |
Correct |
52 ms |
17208 KB |
Output is correct |
49 |
Correct |
36 ms |
11448 KB |
Output is correct |
50 |
Correct |
32 ms |
13772 KB |
Output is correct |
51 |
Correct |
45 ms |
14716 KB |
Output is correct |
52 |
Correct |
45 ms |
15488 KB |
Output is correct |
53 |
Correct |
36 ms |
12960 KB |
Output is correct |
54 |
Correct |
41 ms |
8736 KB |
Output is correct |
55 |
Correct |
40 ms |
8548 KB |
Output is correct |
56 |
Correct |
29 ms |
8176 KB |
Output is correct |
57 |
Correct |
19 ms |
7892 KB |
Output is correct |
58 |
Correct |
16 ms |
7832 KB |
Output is correct |
59 |
Correct |
15 ms |
8008 KB |
Output is correct |
60 |
Correct |
66 ms |
18304 KB |
Output is correct |
61 |
Correct |
61 ms |
18244 KB |
Output is correct |
62 |
Correct |
65 ms |
18312 KB |
Output is correct |
63 |
Correct |
59 ms |
18244 KB |
Output is correct |
64 |
Correct |
77 ms |
18284 KB |
Output is correct |
65 |
Correct |
60 ms |
18312 KB |
Output is correct |
66 |
Correct |
77 ms |
17772 KB |
Output is correct |
67 |
Correct |
59 ms |
17804 KB |
Output is correct |
68 |
Correct |
59 ms |
17956 KB |
Output is correct |
69 |
Correct |
2 ms |
3924 KB |
Output is correct |
70 |
Correct |
2 ms |
3924 KB |
Output is correct |
71 |
Correct |
2 ms |
3924 KB |
Output is correct |
72 |
Correct |
3 ms |
3924 KB |
Output is correct |
73 |
Correct |
3 ms |
3924 KB |
Output is correct |
74 |
Correct |
2 ms |
3924 KB |
Output is correct |
75 |
Correct |
2 ms |
3980 KB |
Output is correct |
76 |
Correct |
3 ms |
3924 KB |
Output is correct |
77 |
Correct |
2 ms |
3924 KB |
Output is correct |
78 |
Correct |
3 ms |
3964 KB |
Output is correct |
79 |
Correct |
3 ms |
3924 KB |
Output is correct |
80 |
Correct |
3 ms |
3924 KB |
Output is correct |
81 |
Correct |
2 ms |
3924 KB |
Output is correct |
82 |
Correct |
3 ms |
3924 KB |
Output is correct |
83 |
Correct |
4 ms |
3924 KB |
Output is correct |
84 |
Correct |
3 ms |
3956 KB |
Output is correct |
85 |
Correct |
3 ms |
3964 KB |
Output is correct |
86 |
Correct |
2 ms |
3960 KB |
Output is correct |
87 |
Correct |
3 ms |
3964 KB |
Output is correct |
88 |
Correct |
2 ms |
3924 KB |
Output is correct |
89 |
Correct |
3 ms |
3924 KB |
Output is correct |
90 |
Correct |
3 ms |
3960 KB |
Output is correct |
91 |
Correct |
2 ms |
3924 KB |
Output is correct |
92 |
Correct |
3 ms |
3972 KB |
Output is correct |
93 |
Correct |
3 ms |
3924 KB |
Output is correct |
94 |
Correct |
2 ms |
3924 KB |
Output is correct |
95 |
Correct |
3 ms |
3964 KB |
Output is correct |
96 |
Correct |
2 ms |
3924 KB |
Output is correct |
97 |
Correct |
3 ms |
3924 KB |
Output is correct |
98 |
Correct |
3 ms |
3964 KB |
Output is correct |
99 |
Correct |
3 ms |
4052 KB |
Output is correct |
100 |
Correct |
3 ms |
4052 KB |
Output is correct |
101 |
Correct |
2 ms |
3924 KB |
Output is correct |
102 |
Correct |
2 ms |
3924 KB |
Output is correct |
103 |
Correct |
2 ms |
3972 KB |
Output is correct |
104 |
Correct |
3 ms |
3924 KB |
Output is correct |
105 |
Correct |
2 ms |
3972 KB |
Output is correct |
106 |
Correct |
3 ms |
3940 KB |
Output is correct |
107 |
Correct |
3 ms |
4088 KB |
Output is correct |
108 |
Correct |
3 ms |
4052 KB |
Output is correct |
109 |
Correct |
4 ms |
4244 KB |
Output is correct |
110 |
Correct |
3 ms |
4076 KB |
Output is correct |
111 |
Correct |
4 ms |
4180 KB |
Output is correct |
112 |
Correct |
4 ms |
4244 KB |
Output is correct |
113 |
Correct |
4 ms |
4180 KB |
Output is correct |
114 |
Correct |
4 ms |
4224 KB |
Output is correct |
115 |
Correct |
3 ms |
4052 KB |
Output is correct |
116 |
Correct |
4 ms |
4228 KB |
Output is correct |
117 |
Correct |
3 ms |
4180 KB |
Output is correct |
118 |
Correct |
22 ms |
7224 KB |
Output is correct |
119 |
Correct |
18 ms |
7712 KB |
Output is correct |
120 |
Correct |
33 ms |
8192 KB |
Output is correct |
121 |
Correct |
4 ms |
4308 KB |
Output is correct |
122 |
Correct |
5 ms |
4316 KB |
Output is correct |
123 |
Correct |
5 ms |
4344 KB |
Output is correct |
124 |
Correct |
4 ms |
4308 KB |
Output is correct |
125 |
Correct |
5 ms |
4308 KB |
Output is correct |
126 |
Correct |
4 ms |
4308 KB |
Output is correct |
127 |
Correct |
4 ms |
4308 KB |
Output is correct |
128 |
Correct |
5 ms |
4224 KB |
Output is correct |
129 |
Correct |
4 ms |
4220 KB |
Output is correct |
130 |
Correct |
4 ms |
4200 KB |
Output is correct |
131 |
Correct |
4 ms |
4308 KB |
Output is correct |
132 |
Correct |
28 ms |
8524 KB |
Output is correct |
133 |
Correct |
28 ms |
8652 KB |
Output is correct |
134 |
Correct |
27 ms |
8544 KB |
Output is correct |
135 |
Correct |
9 ms |
5268 KB |
Output is correct |
136 |
Correct |
172 ms |
43596 KB |
Output is correct |
137 |
Correct |
86 ms |
26868 KB |
Output is correct |
138 |
Correct |
66 ms |
25380 KB |
Output is correct |
139 |
Correct |
76 ms |
27700 KB |
Output is correct |
140 |
Correct |
52 ms |
20764 KB |
Output is correct |
141 |
Correct |
17 ms |
6344 KB |
Output is correct |
142 |
Correct |
16 ms |
6324 KB |
Output is correct |
143 |
Correct |
23 ms |
6992 KB |
Output is correct |
144 |
Correct |
16 ms |
6368 KB |
Output is correct |
145 |
Correct |
18 ms |
6484 KB |
Output is correct |
146 |
Correct |
17 ms |
6028 KB |
Output is correct |
147 |
Correct |
20 ms |
7452 KB |
Output is correct |
148 |
Correct |
9 ms |
5212 KB |
Output is correct |
149 |
Correct |
22 ms |
7744 KB |
Output is correct |
150 |
Correct |
9 ms |
5076 KB |
Output is correct |
151 |
Correct |
27 ms |
8656 KB |
Output is correct |
152 |
Correct |
14 ms |
5876 KB |
Output is correct |
153 |
Correct |
8 ms |
5404 KB |
Output is correct |
154 |
Correct |
10 ms |
5972 KB |
Output is correct |
155 |
Correct |
8 ms |
5252 KB |
Output is correct |
156 |
Correct |
8 ms |
5204 KB |
Output is correct |
157 |
Correct |
10 ms |
5300 KB |
Output is correct |
158 |
Correct |
251 ms |
71608 KB |
Output is correct |
159 |
Correct |
160 ms |
53836 KB |
Output is correct |
160 |
Correct |
128 ms |
37068 KB |
Output is correct |
161 |
Correct |
113 ms |
37928 KB |
Output is correct |
162 |
Correct |
109 ms |
37840 KB |
Output is correct |
163 |
Correct |
23 ms |
7196 KB |
Output is correct |
164 |
Correct |
25 ms |
7316 KB |
Output is correct |
165 |
Correct |
24 ms |
7212 KB |
Output is correct |
166 |
Correct |
23 ms |
7280 KB |
Output is correct |
167 |
Correct |
23 ms |
7268 KB |
Output is correct |
168 |
Correct |
23 ms |
7240 KB |
Output is correct |
169 |
Correct |
32 ms |
9772 KB |
Output is correct |
170 |
Correct |
16 ms |
6100 KB |
Output is correct |
171 |
Correct |
33 ms |
9804 KB |
Output is correct |
172 |
Correct |
15 ms |
6132 KB |
Output is correct |
173 |
Correct |
33 ms |
9756 KB |
Output is correct |
174 |
Correct |
15 ms |
6096 KB |
Output is correct |
175 |
Correct |
11 ms |
6100 KB |
Output is correct |
176 |
Correct |
12 ms |
6064 KB |
Output is correct |
177 |
Correct |
12 ms |
6020 KB |
Output is correct |
178 |
Correct |
10 ms |
5856 KB |
Output is correct |
179 |
Correct |
26 ms |
6908 KB |
Output is correct |
180 |
Correct |
511 ms |
113280 KB |
Output is correct |
181 |
Correct |
513 ms |
146720 KB |
Output is correct |
182 |
Correct |
676 ms |
180808 KB |
Output is correct |
183 |
Correct |
332 ms |
104208 KB |
Output is correct |
184 |
Correct |
272 ms |
79024 KB |
Output is correct |
185 |
Correct |
44 ms |
10380 KB |
Output is correct |
186 |
Correct |
42 ms |
11488 KB |
Output is correct |
187 |
Correct |
50 ms |
11304 KB |
Output is correct |
188 |
Correct |
38 ms |
11724 KB |
Output is correct |
189 |
Correct |
67 ms |
12404 KB |
Output is correct |
190 |
Correct |
53 ms |
13176 KB |
Output is correct |
191 |
Correct |
85 ms |
13040 KB |
Output is correct |
192 |
Correct |
36 ms |
10476 KB |
Output is correct |
193 |
Correct |
56 ms |
10704 KB |
Output is correct |
194 |
Correct |
42 ms |
9028 KB |
Output is correct |
195 |
Correct |
1359 ms |
268780 KB |
Output is correct |
196 |
Correct |
843 ms |
208160 KB |
Output is correct |
197 |
Correct |
714 ms |
195544 KB |
Output is correct |
198 |
Correct |
565 ms |
162116 KB |
Output is correct |
199 |
Correct |
544 ms |
165860 KB |
Output is correct |
200 |
Correct |
133 ms |
19652 KB |
Output is correct |
201 |
Correct |
88 ms |
19672 KB |
Output is correct |
202 |
Correct |
87 ms |
19620 KB |
Output is correct |
203 |
Correct |
101 ms |
19576 KB |
Output is correct |
204 |
Correct |
126 ms |
19720 KB |
Output is correct |
205 |
Correct |
90 ms |
19568 KB |
Output is correct |
206 |
Correct |
126 ms |
18596 KB |
Output is correct |
207 |
Correct |
91 ms |
18552 KB |
Output is correct |
208 |
Correct |
84 ms |
18580 KB |
Output is correct |
209 |
Correct |
91 ms |
18564 KB |
Output is correct |
210 |
Correct |
78 ms |
18588 KB |
Output is correct |
211 |
Correct |
76 ms |
18516 KB |
Output is correct |
212 |
Correct |
58 ms |
18380 KB |
Output is correct |
213 |
Correct |
54 ms |
15556 KB |
Output is correct |
214 |
Correct |
60 ms |
14936 KB |
Output is correct |
215 |
Correct |
55 ms |
14916 KB |
Output is correct |