QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#283883 | #7942. $K$ Subsequences | ucup-team1447# | AC ✓ | 101ms | 15984kb | C++14 | 8.1kb | 2023-12-15 17:27:39 | 2023-12-15 17:27:41 |
Judging History
answer
// dottle bot
#ifndef ONLINE_JUDGE
#define DEBUG
#endif
#include <stdio.h>
#include <string.h>
#include <algorithm>
#include <queue>
#include <vector>
#include <bitset>
#include <map>
#include <assert.h>
#include <math.h>
#include <set>
#include <random>
std::mt19937_64 rnd(586666);
#define nln puts("")
#define od(x) printf("%d",x)
#define odb(x) printf("%d ",x)
#define odl(x) printf("%d\n",x)
#define odp(x,y) printf("%d %d\n",x,y)
#define ol(x) puts("")
#define old(x) printf("%lld",x)
#define oldb(x) printf("%lld ",x)
#define oldl(x) printf("%lld\n",x)
#define oldp(x,y) printf("%lld %lld\n",x,y)
#define rg(x) for(int i=1;i<=(x);i++){
#define rg_(i,x) for(int i=1;i<=(x);i++){
#define fe(u) for(int i=h[u];i;i=e[i].nxt){int v=e[i].v;
#define gr }
#define rrg(x) for(int i=0;i<(x);i++){
#define rdln(a) a[i]=read();
#define rdln0(a,x) rrg(x) rdln(a) gr
#define rdln1(a,x) rg(x) rdln(a) gr
#define int long long
const int mod=998244353;
#ifdef int
#define inf 0x3f3f3f3f3f3f3f3fll
#else
#define inf 0x3f3f3f3f
#endif
inline int min(int a,int b){return a>b?b:a;}
inline int max(int a,int b){return a<b?b:a;}
#define cmlSEGMIN
#define cmlSEGMAX
#define cmlSEGSUM
class SegTreeAl{
#ifdef cmlSEGMIN
int minn[1000005<<2];
#endif
#ifdef cmlSEGMAX
int maxn[1000005<<2];
#endif
#ifdef cmlSEGSUM
int sum[1000005<<2];
#endif
int tag[1000005<<2];
#ifdef cmlSEGSUM
void pushdown(int o,int l,int r)
#else
void pushdown(int o)
#endif
{
int&t=tag[o];
#ifdef cmlSEGMIN
minn[o<<1]+=t;
minn[o<<1|1]+=t;
#endif
#ifdef cmlSEGMAX
maxn[o<<1]+=t;
maxn[o<<1|1]+=t;
#endif
#ifdef cmlSEGSUM
int m=l+r>>1;
sum[o<<1]+=t*(m-l+1);
sum[o<<1|1]+=t*(r-m);
#endif
tag[o<<1]+=t;
tag[o<<1|1]+=t;
t=0;
}
void add(int o,int l,int r,int L,int R,int v)
{
if(L<=l&&r<=R)
{
#ifdef cmlSEGMAX
maxn[o]+=v;
#endif
#ifdef cmlSEGMIN
minn[o]+=v;
#endif
#ifdef cmlSEGSUM
sum[o]+=v*(r-l+1);
#endif
tag[o]+=v;
return;
}
int m=l+r>>1;
#ifdef cmlSEGSUM
pushdown(o,l,r);
#else
pushdown(o);
#endif
if(L<=m)add(o<<1,l,m,L,R,v);
if(m<R)add(o<<1|1,m+1,r,L,R,v);
#ifdef cmlSEGMAX
maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
}
#ifdef cmlSEGMIN
int qmin(int o,int l,int r,int L,int R)
{
if(L<=l&&r<=R)
{
return minn[o];
}
int m=l+r>>1,res=inf;
#ifdef cmlSEGSUM
pushdown(o,l,r);
#else
pushdown(o);
#endif
if(L<=m)res=min(res,qmin(o<<1,l,m,L,R));
if(m<R)res=min(res,qmin(o<<1|1,m+1,r,L,R));
#ifdef cmlSEGMAX
maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
return res;
}
#endif
#ifdef cmlSEGMAX
int qmax(int o,int l,int r,int L,int R)
{
if(L<=l&&r<=R)
{
return maxn[o];
}
int m=l+r>>1,res=-inf;
#ifdef cmlSEGSUM
pushdown(o,l,r);
#else
pushdown(o);
#endif
if(L<=m)res=max(res,qmax(o<<1,l,m,L,R));
if(m<R)res=max(res,qmax(o<<1|1,m+1,r,L,R));
#ifdef cmlSEGMAX
maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
return res;
}
#endif
#ifdef cmlSEGSUM
int qsum(int o,int l,int r,int L,int R)
{
if(L<=l&&r<=R)
{
return sum[o];
}
int m=l+r>>1,res=0;
#ifdef cmlSEGSUM
pushdown(o,l,r);
#else
pushdown(o);
#endif
if(L<=m)res+=qsum(o<<1,l,m,L,R);
if(m<R)res+=qsum(o<<1|1,m+1,r,L,R);
#ifdef cmlSEGMAX
maxn[o]=max(maxn[o<<1],maxn[o<<1|1]);
#endif
#ifdef cmlSEGMIN
minn[o]=min(minn[o<<1],minn[o<<1|1]);
#endif
#ifdef cmlSEGSUM
sum[o]=sum[o<<1]+sum[o<<1|1];
#endif
return res;
}
#endif
};
#define newe(n) struct Edge{int v,w,nxt;}e[2*n+5];\
typedef int arr[n+5];\
arr h;\
int cnt=1;\
inline void addedge(int u,int v,int w){e[cnt]=(Edge){v,w,h[u]};h[u]=cnt++;}\
struct node{\
int u,d;\
bool operator<(const node&b)const{return d>b.d;}\
};\
void dij(int s,int *d,int N)\
{\
memset(d,0x3f,sizeof(int)*(N+3));\
d[s]=0;std::priority_queue<node>q;q.push((node){s,0});\
while(!q.empty())\
{\
int u=q.top().u,D=q.top().d;q.pop();if(D!=d[u])continue;\
for(int i=h[u];i;i=e[i].nxt){int v=e[i].v,w=e[i].w;\
if(d[u]+w<d[v])d[v]=d[u]+w,q.push((node){v,d[v]});\
}\
}\
}
#define mgs int fa[1<<22],sz[1<<22];\
inline int f(int x){return x==fa[x]?x:fa[x]=f(fa[x]);}\
inline int uf(int x,int y)\
{\
int fx=f(x),fy=f(y);\
if(fx==fy)return 0;\
if(sz[fx]>sz[fy])fx^=fy^=fx^=fy;\
fa[fx]=fy,sz[fy]+=sz[fx];\
return 1;\
}
inline int read()
{
int num=0,f=1;char c=getchar();
while(c<48||c>57){if(c=='-')f=-1;c=getchar();}
while(c>47&&c<58)num=num*10+(c^48),c=getchar();
return num*f;
}
inline int re1d()
{
char c=getchar();
while(c<48||c>49)c=getchar();
return c&1;
}
#ifdef cmlBIT
struct BIT{int a[1<<20|1],n;
void add(int x,int p){while(x<=n)a[x]+=p,x+=x&-x;}
int operator[](int x){int res=0;while(x)res+=a[x],x-=x&-x;return res;}
int operator()(int l,int r){return (*this)[r]-(*this)[l-1];}};
#endif
int rnv[1000005];
// #define COMB
#ifdef COMB
#ifndef int
#define int long long
#endif
int fac[1000005],inv[1000005];
#endif
void initprog()
{
#ifdef COMB
fac[0]=inv[0]=inv[1]=1;
rg(1000000)fac[i]=fac[i-1]*i%mod;gr
rg(1000000)if(i>1)inv[i]=inv[mod%i]*(mod-mod/i)%mod;gr
rg(1000000)rnv[i]=inv[i];gr
rg(1000000)inv[i]=inv[i]*inv[i-1]%mod;gr
#endif
}
#ifdef COMB
int C(int n,int m)
{
if(n==m||m==0)return 1;
if(n<m)return 0;
return fac[n]*inv[m]%mod*inv[n-m]%mod;
}
#endif
inline int qp(int a,int b){int c=1;while(b){if(b&1)c=c*a%mod;a=a*a%mod;b>>=1;}return c;}
inline int mae(int &a,int b){a+=b;if(a>=mod)a-=mod;return a;}
inline int mde(int &a,int b){a+=mod-b;if(a>=mod)a-=mod;return a;}
inline int mle(int &a,int b){a=a*b%mod;return a;}
inline int mve(int &a,int b){a=a*qp(b,mod-2)%mod;return a;}
inline int mxe(int &a,int b){return a=a>b?a:b;}
inline int mne(int &a,int b){return a=a<b?a:b;}
inline int ae(int a,int b){int c=a+b;return c>=mod?c-mod:c;}
inline int de(int a,int b){return ae(a,mod-b);}
inline int me(int a,int b){return a*b%mod;}
inline int mive(int &a,int b){a=a*rnv[b]%mod;return a;}
inline int ive(int a,int b){return a*rnv[b]%mod;}
inline int ve(int a,int b){return a*qp(b,mod-2)%mod;}
#ifdef cmlST
struct STmin{
int a[21][1000005],n;
void init(int N,int *b)
{
n=N;
rg(n)a[0][i]=b[i];gr
rg(20)rg_(j,n-(1<<i)+1)a[i][j]=min(a[i-1][j],a[i-1][j+(1<<i-1)]);gr gr
}
int q(int l,int r)
{
int d=std::__lg(r-l+1);
return min(a[d][l],a[d][r-(1<<d)+1]);
}
};
struct STmax{
int a[21][1000005],n;
void init(int N,int *b)
{
n=N;
rg(n)a[0][i]=b[i];gr
rg(20)rg_(j,n-(1<<i)+1)a[i][j]=max(a[i-1][j],a[i-1][j+(1<<i-1)]);gr gr
}
int q(int l,int r)
{
int d=std::__lg(r-l+1);
return max(a[d][l],a[d][r-(1<<d)+1]);
}
};
#endif
#ifdef cmlSAM
struct SAM{
int ch[1000005][26],lnk[1000005],len[1000005],lst=1,cc=1;
int sz[1000005];
void insert(int c)
{
len[++cc]=len[lst]+1;sz[cc]=1;
int p=lst;lst=cc;
while(p&&ch[p][c]==0)ch[p][c]=cc,p=lnk[p];
if(p==0)lnk[cc]=1;
else
{
int x=ch[p][c];
if(len[p]+1==len[x])lnk[cc]=x;
else
{
int q=cc;++cc;
lnk[cc]=lnk[x];
lnk[x]=lnk[q]=cc;
len[cc]=len[p]+1;
memcpy(ch[cc],ch[x],sizeof(ch[cc]));
while(p&&ch[p][c]==x)ch[p][c]=cc,p=lnk[p];
}
}
}
newe(1000005);
long long ans;
void build()
{
rg(cc)addedge(lnk[i],i,0);gr
}
void dfs(int u)
{
fe(u)dfs(v),sz[u]+=sz[v];gr
if(sz[u]>1)ans=max(ans,1ll*sz[u]*len[u]);
}
}t;
#endif
signed main()
{
initprog();
int T=read();rg(T)
int n=read(),k=read();
std::set<std::pair<int,int> >s;
rg(k)s.insert({0,i});gr
rg(n)
int x=read();
if(x==1)
{
auto a=*s.begin();s.erase(a);
odb(a.second);a.first++;
s.insert(a);
}
else
{
auto a=*--s.end();s.erase(a);
odb(a.second);
if(a.first)a.first--;
s.insert(a);
}
gr
puts("");
gr
return 0;
}
这程序好像有点Bug,我给组数据试试?
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3632kb
input:
5 3 2 1 -1 1 4 2 -1 1 1 -1 7 3 1 1 1 1 1 1 1 10 3 1 1 1 1 -1 -1 1 1 1 1 12 4 1 1 1 1 -1 -1 -1 -1 1 1 1 1
output:
1 1 1 2 1 2 2 1 2 3 1 2 3 1 1 2 3 1 1 3 3 1 2 3 1 2 3 4 4 3 2 1 1 2 3 4
result:
ok Correct (5 test cases)
Test #2:
score: 0
Accepted
time: 17ms
memory: 3928kb
input:
18434 10 1 -1 1 1 -1 -1 1 -1 -1 1 1 10 2 -1 -1 -1 1 1 -1 1 1 1 1 10 2 1 -1 -1 -1 -1 1 1 -1 1 1 10 7 1 1 -1 1 -1 1 1 -1 -1 1 9 1 -1 1 -1 1 1 -1 1 -1 1 8 1 -1 -1 -1 -1 1 1 -1 -1 10 3 -1 -1 -1 1 1 1 1 -1 -1 -1 9 1 1 -1 -1 1 -1 -1 -1 -1 -1 10 10 -1 1 1 1 1 1 1 1 1 1 10 4 -1 1 -1 1 -1 1 1 -1 1 1 9 3 1 1 ...
output:
1 1 1 1 1 1 1 1 1 1 2 2 2 1 2 2 2 1 2 1 1 1 2 2 2 1 2 2 2 1 1 2 2 2 2 2 3 3 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 3 1 2 3 1 1 3 2 1 1 1 1 1 1 1 1 1 10 1 2 3 4 5 6 7 8 9 4 1 1 1 1 1 2 2 2 3 1 2 2 1 1 1 1 1 3 1 2 2 2 3 4 4 4 7 1 2 3 4 5 6 7 7 7 1 1 6 1 1 6 1 2 2 1 1 1 1 1 1 1 1 1 1 ...
result:
ok Correct (18434 test cases)
Test #3:
score: 0
Accepted
time: 19ms
memory: 3660kb
input:
1 199996 3 1 -1 1 1 1 1 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 152 1 1 1 2 2 1 1 2 2 2 2 2 2 2 2 2 2 2 2 2 2 1 1 1 1 2 3 4 4 4 5 6 6 5 5 5 4 4 5 5 4 3 2 2 2 1 1 1 1 2 2 2 3 3 2 2 2 1 1 1 1 1 1 2 2 2 2 2 3 4 5 5 4 4 5 5 5 6 7 8 9 10 10 9 9 ...
result:
ok Correct (1 test case)
Test #5:
score: 0
Accepted
time: 27ms
memory: 3716kb
input:
1 199996 136 -1 1 1 1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 1 1 1 -1 1 1 1 1 1 -1 -1 1 -1 1 -1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 1 1...
output:
136 1 2 3 4 5 5 5 5 4 4 4 4 5 5 4 4 5 6 7 8 8 8 8 7 7 7 7 8 8 7 7 7 6 6 6 6 7 8 9 10 11 11 10 9 8 8 8 7 6 5 4 3 2 1 1 2 3 3 3 4 5 5 5 6 7 8 9 9 8 8 8 8 8 7 7 8 9 10 10 10 10 9 8 7 7 8 8 7 6 5 5 5 5 6 7 8 9 9 8 8 9 10 11 12 13 14 15 16 17 18 18 17 16 16 17 18 19 20 20 20 21 21 21 22 23 23 23 24 24 23...
result:
ok Correct (1 test case)
Test #6:
score: 0
Accepted
time: 78ms
memory: 9392kb
input:
1 199998 86240 1 1 -1 1 1 1 1 1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 1 -1 1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 1 -1 1 -1 -1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 1 1 -1...
output:
1 2 2 2 3 4 5 6 7 7 7 8 8 8 8 7 6 6 7 8 9 10 11 12 12 12 13 14 15 16 16 16 16 15 14 13 12 11 10 9 9 9 8 8 8 7 6 5 5 6 6 5 4 4 5 5 4 4 5 5 5 5 5 5 5 5 5 6 7 8 9 9 9 9 9 9 9 9 8 8 9 10 10 9 8 7 6 5 5 6 7 8 8 7 6 6 7 7 6 6 6 6 7 8 8 7 6 6 6 5 4 3 3 4 4 3 3 3 3 3 2 2 2 1 86240 86240 86240 86240 1 1 1 2 ...
result:
ok Correct (1 test case)
Test #7:
score: 0
Accepted
time: 101ms
memory: 15984kb
input:
1 199998 196586 1 -1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 1 1 -1 1 1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 -1...
output:
1 1 196586 196586 1 1 1 1 1 1 196586 196586 1 1 196586 196586 1 1 196586 196586 196586 196586 1 1 1 2 3 3 2 1 1 1 196586 196586 1 2 2 2 2 2 2 2 3 4 4 3 2 1 1 1 196586 196586 1 1 196586 1 1 196586 196586 1 2 3 4 5 5 5 6 6 6 7 8 9 9 8 7 7 8 8 7 7 8 8 7 6 6 6 5 4 4 4 3 2 2 2 1 1 1 1 1 196586 1 1 1 1 1 ...
result:
ok Correct (1 test case)
Test #8:
score: 0
Accepted
time: 74ms
memory: 11052kb
input:
2 53064 32664 1 1 1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 2 2 1 2 1 2 2 2 2 2 1 1 1 1 2 2 2 1 2 1 1 1 2 2 1 2 2 2 2 2 1 1 1 2 1 1 1 1 1 1 1 1 2 1 2 1 2 1 2 1 2 2 1 1 1 1 1 2 1 2 1 2 1 1 1 1 1 1 1 1 1 2 2 1 2 2 1 2 2 2 2 2 2 1 2 1 2 1 2 2 2 2 2 2 1 1 2 2 1 1 1 2 2 ...
result:
ok Correct (2 test cases)
Test #10:
score: 0
Accepted
time: 37ms
memory: 5476kb
input:
2 114819 248 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 -...
output:
248 248 248 248 248 1 1 1 1 248 1 1 1 2 2 2 2 1 1 1 248 1 1 1 1 1 1 248 248 248 248 248 248 248 1 1 1 1 248 1 1 1 2 3 4 4 3 2 1 1 2 3 4 5 5 4 4 4 3 2 2 2 1 248 1 1 248 1 2 2 1 248 1 2 2 1 248 1 1 1 1 248 248 1 2 2 1 248 248 1 2 3 3 2 1 248 1 1 248 248 1 2 3 3 2 1 248 248 1 1 248 248 248 248 248 1 2 ...
result:
ok Correct (2 test cases)
Test #11:
score: 0
Accepted
time: 48ms
memory: 5656kb
input:
2 51745 1 -1 1 1 -1 1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 1 1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 1 1 -1 1 1 -1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -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 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok Correct (2 test cases)
Test #13:
score: 0
Accepted
time: 24ms
memory: 3724kb
input:
3 509 3 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -...
output:
3 3 1 2 2 1 1 2 2 1 3 1 1 3 3 3 3 3 3 1 2 2 1 1 2 3 3 3 3 3 3 2 2 2 2 2 2 2 1 3 1 1 3 3 1 2 3 3 2 1 3 3 1 1 1 1 3 3 3 1 1 3 3 1 1 3 1 1 1 1 3 1 1 1 2 2 1 3 1 1 1 2 2 1 1 2 2 1 1 1 3 1 2 3 3 3 3 3 3 2 1 1 2 3 3 3 1 2 3 3 3 3 3 3 3 1 2 2 1 3 2 1 1 1 3 2 2 3 1 1 3 2 2 2 2 2 1 3 3 3 3 1 2 3 1 1 3 2 2 2 ...
result:
ok Correct (3 test cases)
Test #14:
score: 0
Accepted
time: 19ms
memory: 3656kb
input:
4 25729 81 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 -1 1 1 1 1 1 1 -1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 -1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 1 -1 1 1 -1 -1 1 1 1 1 1 1 -1 -1 1 1 -1 1 1 -1 -1 1 -1 1 ...
output:
81 81 81 81 1 1 81 81 81 81 81 81 81 1 1 1 1 81 81 1 1 81 1 1 1 2 3 3 2 2 3 3 3 3 2 2 2 1 81 1 1 1 1 81 81 81 81 81 1 2 2 1 1 1 1 2 3 4 5 6 6 6 7 8 8 7 6 6 7 8 9 10 11 12 12 11 10 9 9 9 8 7 6 6 6 6 6 6 7 7 7 7 7 8 8 7 7 8 9 10 11 12 12 11 11 12 12 12 13 13 12 12 12 12 13 13 12 11 11 11 10 10 10 9 9 ...
result:
ok Correct (4 test cases)
Test #15:
score: 0
Accepted
time: 46ms
memory: 6128kb
input:
5 7824 2 -1 -1 -1 -1 1 1 1 1 -1 1 1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 1 1 -1 1 1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 1 -1 1 1 1 -1 -1...
output:
2 2 2 2 1 2 1 2 2 2 1 2 2 2 2 1 1 2 2 1 2 2 2 2 2 2 2 2 1 1 1 2 1 2 2 2 1 1 1 2 1 1 1 1 2 1 1 1 2 1 1 1 2 2 2 1 2 2 2 1 2 1 2 2 2 1 2 2 1 1 2 1 2 2 2 2 1 1 1 1 1 1 1 1 1 2 2 1 1 1 1 1 1 1 2 1 2 2 2 2 1 2 1 2 2 1 1 1 1 1 1 1 2 1 1 2 1 1 1 2 2 1 1 1 1 2 1 2 2 2 1 2 1 1 1 1 2 1 1 2 1 2 1 2 2 1 1 2 1 2 ...
result:
ok Correct (5 test cases)
Test #16:
score: 0
Accepted
time: 24ms
memory: 4196kb
input:
6 7149 4795 -1 -1 1 -1 -1 1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 1 1 1 1 -1 1 -1 1 1 1 -1 -1 1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 -1 -1...
output:
4795 4795 1 1 4795 1 2 2 2 3 4 5 5 5 5 4 3 2 1 4795 4795 1 1 4795 1 1 4795 1 1 4795 4795 4795 1 2 3 4 4 4 4 4 5 6 6 5 5 5 5 6 7 7 7 8 9 10 10 10 10 10 10 10 10 10 11 12 13 14 15 16 17 17 17 17 16 15 14 13 12 11 10 9 9 10 10 10 11 11 10 9 8 8 9 10 10 10 11 11 11 11 11 11 11 12 12 12 12 11 10 10 11 12...
result:
ok Correct (6 test cases)
Test #17:
score: 0
Accepted
time: 17ms
memory: 3704kb
input:
7 16819 1 1 1 1 1 1 1 -1 -1 -1 1 1 1 -1 1 1 1 -1 1 1 -1 -1 -1 1 1 1 1 -1 1 1 -1 1 -1 1 1 -1 -1 1 1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 1 -1 1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 -1 1 ...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok Correct (7 test cases)
Test #18:
score: 0
Accepted
time: 34ms
memory: 5312kb
input:
8 29021 106 -1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 1 1 1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 ...
output:
106 106 106 106 1 1 1 1 1 1 1 2 3 3 2 2 3 4 5 6 6 5 5 6 6 5 4 4 5 5 4 3 2 1 106 1 2 2 2 3 4 4 3 2 2 3 4 5 6 7 8 9 9 9 9 9 9 8 8 8 8 8 8 8 8 9 9 9 10 10 10 10 9 8 8 9 10 11 11 10 9 8 8 8 8 8 7 7 8 8 7 6 6 6 6 7 7 7 8 9 9 9 9 9 10 10 9 8 8 8 7 6 6 6 5 5 6 6 6 7 7 7 7 6 5 4 3 3 4 5 5 5 5 5 6 7 7 6 5 4 ...
result:
ok Correct (8 test cases)
Test #19:
score: 0
Accepted
time: 24ms
memory: 4828kb
input:
9 37136 1 -1 1 -1 -1 -1 -1 1 -1 1 -1 -1 1 1 1 1 1 1 1 -1 1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 -1 -1 1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -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1 1596 1596 1 ...
result:
ok Correct (10 test cases)
Test #21:
score: 0
Accepted
time: 23ms
memory: 3848kb
input:
100 2336 29 -1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 -1 1 1 1 1 1 1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 -1 1 1 1 1 -1 1 1 -1 1 -1 1 1 1 -1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 1 1 1 1 1 -1 1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 1 1 1 1 -1 1 -1 -1 -1 ...
output:
29 29 29 1 1 1 2 2 1 29 1 1 29 1 2 3 4 5 6 6 5 5 6 6 6 6 5 4 4 4 3 3 4 5 6 6 6 7 7 7 7 7 8 9 9 8 7 6 5 5 6 6 6 7 7 6 6 7 7 6 6 7 7 6 6 6 5 4 4 4 3 2 2 3 4 5 6 6 5 5 5 4 3 2 1 29 1 1 1 2 3 4 5 5 5 6 7 7 7 8 9 9 9 9 9 9 9 10 11 12 13 13 13 13 12 11 11 12 12 11 11 12 13 14 15 15 14 13 12 12 13 13 13 14...
result:
ok Correct (100 test cases)
Test #22:
score: 0
Accepted
time: 22ms
memory: 4188kb
input:
101 92 1 1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 1 -1 1 1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 1 1 -1 -1 2647 2314 -1 1 -1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 -1 1 -1 -1...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2314 1 1 2314 1 2 3 3 3 4 5 6 6 6 6 5 5 5 4 3 3 3 2 1 1 2 2 1 1 1 2314 2314 2314 2314 1 2 2 1 2314 2314 1 2 3 3 2 2...
result:
ok Correct (101 test cases)
Test #23:
score: 0
Accepted
time: 27ms
memory: 4396kb
input:
102 8381 7064 -1 -1 1 1 -1 -1 1 -1 1 1 1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 1 1 1 1 1 1 -1 -1 1 -1 1 -1 -1 -1 -1 1 1 -1 1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 -1...
output:
7064 7064 1 2 2 1 1 1 1 2 3 4 5 5 4 4 4 4 4 4 5 6 6 5 4 4 4 4 5 6 7 7 6 5 4 4 5 6 6 5 5 6 6 6 6 6 6 5 5 5 4 4 4 4 5 5 4 4 5 6 6 5 4 4 5 6 7 8 9 9 8 8 8 8 8 7 6 5 5 6 6 6 7 7 6 6 6 5 5 5 4 3 3 3 2 2 2 2 3 3 2 2 3 4 5 5 4 4 5 6 6 6 6 5 4 4 4 4 4 3 2 2 2 1 1 1 1 2 2 1 1 1 7064 7064 7064 1 2 2 1 1 1 1 1...
result:
ok Correct (102 test cases)
Test #24:
score: 0
Accepted
time: 24ms
memory: 3944kb
input:
103 1976 404 1 -1 -1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 1 -1 1 -1 1 -1 -1 1 1 1 1 -1 -1 1 1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 -1 -1 1 -1 -1 1 1 1 1 1 1 -1 -1 1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 1 1 -1 1 -1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 -1 1 1 1 1 -1 -...
output:
1 1 404 1 1 404 404 404 1 2 3 3 3 4 4 3 3 3 3 3 3 3 2 2 3 4 5 5 4 4 5 6 6 6 6 5 5 5 5 5 5 5 5 6 7 8 9 10 10 9 9 9 8 8 9 10 11 12 13 13 12 12 13 14 15 15 14 13 13 13 13 13 13 14 15 16 16 16 16 15 14 13 13 13 12 12 12 11 10 10 10 9 8 8 8 8 9 9 9 10 10 10 10 10 10 9 8 7 6 5 5 6 7 8 8 7 6 6 7 7 7 8 8 8 ...
result:
ok Correct (103 test cases)
Test #25:
score: 0
Accepted
time: 29ms
memory: 4224kb
input:
104 3135 3 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 -1 -1 1 1 -1 -1 1 -1 -1 -1 -1 1 -1 1 1 1 1 1 1 -1 1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 -1 1 1 1 1 -1 1 -1 1 1 -1...
output:
1 1 3 3 3 3 3 3 3 3 3 1 2 2 1 1 2 3 3 2 1 3 1 2 2 2 2 1 3 3 3 3 1 2 2 1 3 1 2 2 1 1 2 2 1 3 1 1 1 2 2 1 3 3 1 1 3 3 1 1 1 1 1 1 1 1 3 1 2 2 1 1 1 3 3 3 1 1 1 2 3 1 2 3 3 3 3 2 2 3 1 2 3 1 2 3 3 2 2 3 1 2 3 1 1 1 2 3 1 1 1 1 1 2 2 1 3 3 1 2 3 3 3 1 2 2 1 1 1 1 2 3 1 1 1 2 2 1 3 2 2 3 3 3 1 2 3 3 3 1 ...
result:
ok Correct (104 test cases)
Test #26:
score: 0
Accepted
time: 19ms
memory: 3864kb
input:
105 1344 10 1 1 1 -1 1 -1 1 -1 -1 -1 -1 -1 1 1 1 1 1 -1 1 1 1 -1 1 -1 1 1 1 1 1 -1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 1 -1 1 -1 -1 -1 -1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 1 1 -1 1 -1 1 1 1 1 -1 1 1 1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 -1 1 1 1 -1 1 -1 1 -1 -1 1 1 -1 -1 1 1 -1...
output:
1 2 3 3 3 3 3 3 2 1 10 10 1 2 3 4 5 5 5 6 7 7 7 7 7 8 9 10 1 1 10 9 9 10 10 9 8 8 8 7 7 7 6 5 5 5 5 6 6 6 6 6 7 7 7 7 6 5 4 3 2 1 10 1 1 1 1 10 10 1 1 10 1 1 1 2 3 3 3 3 3 4 5 6 6 6 7 8 8 8 8 7 6 6 6 6 7 7 7 7 7 8 9 9 9 9 9 9 8 8 9 9 8 8 9 9 9 9 8 7 6 6 6 5 4 4 5 6 6 6 7 7 6 6 7 7 7 8 9 10 1 2 2 2 3...
result:
ok Correct (105 test cases)
Test #27:
score: 0
Accepted
time: 25ms
memory: 3988kb
input:
1000 1284 8 1 1 1 1 -1 1 -1 -1 -1 -1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 1 -1 1 1 1 1 -1 -1 1 -1 1 -1 1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 -1 1 1 -1 -1 1 -1 -1 1 1 1 1 -1 1 -1 1 1 1 -1 1 1 1 -1 1 1 -1 1 -1 1 -1 -1 -1 1 1 -1 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:
ok Correct (1001 test cases)
Test #29:
score: 0
Accepted
time: 21ms
memory: 3756kb
input:
1002 182 6 1 1 1 1 -1 -1 1 -1 -1 1 1 -1 1 1 -1 1 1 1 1 1 -1 -1 -1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 1 1 -1 -1 -1 -1 -1 1 -1 -1 1 1 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 1 1 1 1 -1 1 1 -1 -1 -1 -1 1 1 1 1 1 1 1 -1 1 -1 -1 -1 1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 1...
output:
1 2 3 4 4 3 3 3 2 2 3 3 3 4 4 4 5 6 1 2 2 1 6 5 5 5 5 6 1 1 6 6 1 2 3 3 3 4 4 3 2 1 6 6 6 5 5 6 6 5 4 4 4 4 4 3 2 2 3 4 4 4 5 6 1 1 6 5 4 3 3 3 3 3 3 4 4 3 3 4 5 6 6 6 1 1 6 5 4 4 5 6 1 2 3 4 4 4 4 3 2 2 2 1 6 5 5 6 6 5 4 3 3 3 3 4 5 6 6 6 1 2 2 2 2 1 6 5 5 5 4 3 3 3 2 2 2 1 6 1 1 6 1 1 1 2 3 4 4 3 ...
result:
ok Correct (1002 test cases)
Test #30:
score: 0
Accepted
time: 25ms
memory: 3696kb
input:
1003 95 16 1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 1 1 -1 1 -1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 -1 -1 -1 -1 1 1 -1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 1 1 1 -1 -1 1 1 526 3 1 -1 -1 1 1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1...
output:
1 1 16 1 2 3 3 2 1 16 16 1 2 3 3 2 1 16 1 2 3 3 3 3 3 4 4 3 2 1 1 1 1 1 16 16 1 1 16 1 1 1 1 16 1 1 16 1 1 16 16 1 2 3 3 3 4 5 5 4 3 2 2 3 3 3 4 5 6 7 7 6 6 7 7 6 5 5 5 4 3 2 1 1 1 16 16 1 2 3 4 4 3 3 4 1 1 3 1 2 2 1 3 3 3 3 3 3 3 3 1 1 1 2 3 3 2 2 3 1 1 1 2 2 2 2 1 3 2 2 3 1 1 1 1 3 3 1 1 1 1 1 2 ...
result:
ok Correct (1003 test cases)
Test #31:
score: 0
Accepted
time: 25ms
memory: 3748kb
input:
1004 322 257 -1 1 1 1 1 1 1 -1 -1 1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 -1 1 1 1 1 1 1 -1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 1 1 1 -1 1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 -1 1 -1 1 1 1 -1 1 1 1 -1 -1 1 1 -1 -1 -1 1 1 1 1 1 1 1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 -1 1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1 1 1 -1 -1 1 -1 -1 1 -1...
output:
257 1 2 3 4 5 6 6 5 5 6 6 5 4 4 4 3 3 3 3 3 2 1 1 2 3 4 5 6 6 6 7 7 7 7 7 7 7 8 8 8 8 8 9 10 10 10 11 11 10 10 10 10 11 11 10 9 9 9 9 9 9 9 9 10 11 11 11 12 13 13 12 12 13 13 12 11 11 12 13 14 15 16 17 17 16 16 17 18 19 20 21 22 23 23 22 21 21 21 21 21 21 22 22 21 20 20 20 20 21 22 23 23 22 22 22 21...
result:
ok Correct (1004 test cases)
Test #32:
score: 0
Accepted
time: 24ms
memory: 3684kb
input:
1005 508 4 1 -1 -1 -1 1 1 1 1 1 1 1 -1 1 1 1 -1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 1 -1 -1 1 1 -1 1 1 -1 1 -1 -1 -1 -1 1 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 1 1 3 3 1 2 2 2 3 1 2 3 3 3 1 2 2 1 3 2 1 1 1 1 8 8 8 1 1 8 1 1 1 1 1 2 2 2 3 3 3 3 3 3 3 4 4 4 5 5 5 5 4 3...
result:
ok Correct (9995 test cases)
Test #34:
score: 0
Accepted
time: 18ms
memory: 3716kb
input:
9996 27 1 1 1 -1 -1 -1 -1 -1 -1 -1 1 1 1 -1 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 1 1 7 2 1 1 1 1 -1 -1 1 22 3 -1 -1 1 1 -1 -1 -1 1 1 1 -1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 37 4 -1 -1 -1 1 -1 1 -1 -1 -1 1 1 -1 1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 -1 1 1 1 1 1 1 -1 1 1 1 7 1 -1 1 -1 -1 1 1 1 29 1 -1 -1 1 -1 1 -1 1...
output:
1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 1 3 3 1 2 2 1 3 1 2 3 3 2 1 3 3 1 1 1 2 2 1 1 4 4 4 1 1 1 1 4 4 1 2 2 2 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 1 2 3 4 4 4 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 1 2 3 4 5 6 7 7 6 5 4 3 3 1 2 2 ...
result:
ok Correct (9996 test cases)
Test #35:
score: 0
Accepted
time: 23ms
memory: 3716kb
input:
9997 15 9 -1 1 1 -1 1 1 -1 1 -1 1 1 1 1 1 1 1 1 1 37 20 -1 1 -1 -1 1 -1 -1 1 -1 -1 -1 1 -1 1 1 -1 1 1 -1 -1 -1 -1 1 1 -1 1 -1 -1 -1 1 -1 1 1 1 1 1 -1 64 2 -1 -1 -1 -1 -1 1 1 1 1 1 1 1 1 -1 -1 -1 -1 -1 -1 1 1 -1 -1 -1 -1 -1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ok Correct (9998 test cases)
Test #37:
score: 0
Accepted
time: 22ms
memory: 3716kb
input:
9999 65 2 -1 -1 1 1 -1 -1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 -1 1 1 -1 -1 1 -1 1 1 1 -1 -1 1 1 1 1 -1 1 -1 1 -1 1 -1 -1 -1 1 1 -1 -1 -1 -1 1 1 1 1 -1 -1 1 -1 1 1 1 1 1 1 1 1 12 3 1 1 1 1 -1 -1 -1 -1 1 1 -1 -1 75 2 1 -1 1 -1 -1 -1 1 1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 -1 1 1 -1 1 -1 -1 1 -1 -1 -1 1 1 -1 1 1...
output:
2 2 1 2 2 1 2 1 1 2 2 1 2 2 1 2 2 1 1 1 2 2 1 1 1 1 2 1 1 2 2 1 2 1 1 1 1 1 1 1 1 2 1 1 2 2 1 2 1 1 2 1 2 2 1 1 1 1 2 1 2 1 2 1 2 1 2 3 1 1 3 2 1 1 2 2 1 1 1 1 1 2 2 1 2 2 2 2 2 2 1 2 1 2 1 1 1 1 1 2 2 2 2 1 1 1 2 1 1 2 2 2 1 1 1 1 2 2 2 2 2 2 1 2 2 1 2 1 2 2 1 1 1 1 2 2 1 2 1 2 2 1 1 2 1 2 2 2 2 ...
result:
ok Correct (9999 test cases)
Test #38:
score: 0
Accepted
time: 18ms
memory: 3716kb
input:
10000 15 3 -1 1 -1 1 -1 -1 1 -1 1 -1 1 -1 -1 -1 1 3 3 -1 1 1 34 2 -1 -1 -1 -1 1 -1 1 -1 -1 -1 -1 1 -1 -1 -1 1 -1 -1 1 -1 1 -1 -1 1 -1 1 1 -1 -1 -1 1 -1 1 1 3 2 1 1 -1 25 2 -1 -1 1 1 1 -1 1 -1 1 -1 -1 -1 1 1 1 -1 1 1 1 1 -1 1 -1 1 -1 11 1 1 -1 -1 -1 -1 -1 1 -1 -1 -1 1 29 2 -1 -1 -1 1 -1 1 -1 -1 -1 -1...
output:
3 1 1 1 1 3 1 1 1 1 1 1 3 3 1 3 1 2 2 2 2 2 1 1 1 1 2 2 2 1 1 2 2 1 1 2 1 1 1 1 2 1 1 1 2 2 1 2 1 1 1 2 1 2 2 2 2 1 2 1 1 1 1 1 1 2 1 1 2 1 1 1 2 1 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1 1 2 2 2 1 1 1 1 2 2 2 2 2 1 2 1 2 2 1 2 2 2 2 2 1 1 2 2 2 1 1 1 4 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 ...
result:
ok Correct (10000 test cases)
Extra Test:
score: 0
Extra Test Passed