QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#615779 | #5466. Permutation Compression | crush_codemaker | TL | 537ms | 20464kb | C++14 | 5.4kb | 2024-10-05 20:08:45 | 2024-10-05 20:08:46 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
#define N 200007
#pragma GCC optimize(2)
using namespace std;
int T,n,m,k,psize;
int a[N],b[N],mk[N];
struct Node
{
int id,x;
bool operator <(const Node&other) const
{
return x>other.x;
}
};
//priority_queue<Node>p;
Node p[N];
struct segment_tree3
{
int sm[N<<2];
void pu(const int& i)
{
sm[i]=sm[i<<1]+sm[i<<1|1];
}
void bd(const int& i,const int& l,const int& r)
{
if(l==r)
{
sm[i]=0;
}
else
{
int mid=(l+r)>>1;
bd(i<<1,l,mid);
bd(i<<1|1,mid+1,r);
pu(i);
}
}
void up(const int& x,const int& id,const int& i,const int& l,const int& r)
{
if(l==r)
{
sm[i]+=x;
}
else
{
int mid=(l+r)>>1;
if(id<=mid)
{
up(x,id,i<<1,l,mid);
}
else
{
up(x,id,i<<1|1,mid+1,r);
}
pu(i);
}
}
int qr(const int& L,const int& R,const int& i,const int& l,const int& r)
{
if(L<=l&&r<=R)
{
return sm[i];
}
else
{
int mid=(l+r)>>1,ans=0;
if(L<=mid)
{
ans+=qr(L,R,i<<1,l,mid);
}
if(R>mid)
{
ans+=qr(L,R,i<<1|1,mid+1,r);
}
return ans;
}
}
void init()
{
bd(1,1,n);
}
void ins(const int& x)
{
up(1,x,1,1,n);
}
void del(const int& x)
{
up(-1,x,1,1,n);
}
int qur(const int& z)
{
if(qr(1,z,1,1,n)==0)
{
return 0;
}
int l=1,r=z;
while(l<r)
{
int mid=(l+r+1)>>1;
if(qr(mid,z,1,1,n))
{
l=mid;
}
else
{
r=mid-1;
}
}
int ans=l;
return ans;
}
}T3;
struct segment_tree2
{
int sm[N<<2];
void pu(const int& i)
{
sm[i]=sm[i<<1]+sm[i<<1|1];
}
void bd(const int& i,const int& l,const int& r)
{
if(l==r)
{
sm[i]=0;
}
else
{
int mid=(l+r)>>1;
bd(i<<1,l,mid);
bd(i<<1|1,mid+1,r);
pu(i);
}
}
void up(const int& x,const int& id,const int& i,const int& l,const int& r)
{
if(l==r)
{
sm[i]=x;
}
else
{
int mid=(l+r)>>1;
if(id<=mid)
{
up(x,id,i<<1,l,mid);
}
else
{
up(x,id,i<<1|1,mid+1,r);
}
pu(i);
}
}
int qr(const int& L,const int& R,const int& i,const int& l,const int& r)
{
if(L<=l&&r<=R)
{
return sm[i];
}
else
{
int mid=(l+r)>>1,ans=0;
if(L<=mid)
{
ans+=qr(L,R,i<<1,l,mid);
}
if(R>mid)
{
ans+=qr(L,R,i<<1|1,mid+1,r);
}
return ans;
}
}
void init()
{
bd(1,1,n);
}
int qur(const int& L,const int& R)
{
return qr(L,R,1,1,n);
}
}T2;
struct segment_tree1
{
int mx[N<<2];
void pu(const int& i)
{
mx[i]=max(mx[i<<1],mx[i<<1|1]);
}
void bd(const int& i,const int& l,const int& r)
{
if(l==r)
{
mx[i]=a[l];
}
else
{
int mid=(l+r)>>1;
bd(i<<1,l,mid);
bd(i<<1|1,mid+1,r);
pu(i);
}
}
void up(const int& x,const int& id,const int& i,const int& l,const int& r)
{
if(l==r)
{
mx[i]=x;
}
else
{
int mid=(l+r)>>1;
if(id<=mid)
{
up(x,id,i<<1,l,mid);
}
else
{
up(x,id,i<<1|1,mid+1,r);
}
pu(i);
}
}
int qr(const int& L,const int& R,const int& i,const int& l,const int& r)
{
if(L<=l&&r<=R)
{
return mx[i];
}
else
{
int mid=(l+r)>>1,ans=0;
if(L<=mid)
{
ans=max(ans,qr(L,R,i<<1,l,mid));
}
if(R>mid)
{
ans=max(ans,qr(L,R,i<<1|1,mid+1,r));
}
return ans;
}
}
void init()
{
bd(1,1,n);
}
int qur(const int& id)
{
int l=1,r=id;
while(l<r)
{
int mid=(l+r)>>1;
if(qr(mid,id,1,1,n)<=a[id])
{
r=mid;
}
else
{
l=mid+1;
}
}
int ansl=l;
l=id,r=n;
while(l<r)
{
int mid=(l+r+1)>>1;
if(qr(id,mid,1,1,n)<=a[id])
{
l=mid;
}
else
{
r=mid-1;
}
}
int ansr=r;
int ans=ansr-ansl+1;
/*cout<<a[id]<<": "<<endl;
cout<<ansl<<" "<<ansr<<" "<<T2.qur(ansl,ansr)<<endl;*/
return ans-T2.qur(ansl,ansr);
}
}T1;
int judge()
{
for(int i=1;i<=n;i++)
{
mk[i]=0;
}
int u=1,v=1;
while(u<=n&&v<=m)
{
while(u<=n&&a[u]!=b[v])
{
u++;
}
if(u>n)
{
return 0;
}
mk[u]=1;
u++;
v++;
}
if(v>m)
{
return 1;
}
return 0;
}
void solve()
{
std::cin >> n >> m >> k;
// n = 2e5, m = 2e5 - 1; k = 2e5 - 1;
for(int i=1;i<=n;i++)
{
// a[i] = i;
std::cin >> a[i];
}
for(int i=1;i<=m;i++)
{
// b[i] = i + 1;
std::cin >> b[i];
}
T3.init();
for(int i=1;i<=k;i++)
{
int x;
std::cin >> x;
T3.ins(x);
}
if(n-m>k)
{
std::cout << "NO\n";
return ;
}
if(!judge())
{
std::cout << "NO\n";
return ;
}
T1.init();
T2.init();
// while(!p.empty())
// {
// p.pop();
// }
// for(int i=1;i<=n;i++)
// {
// if(!mk[i])
// {
// p.push({i,a[i]});
// }
// }
psize=0;
for (int i=1;i<=n;i++){
if (!mk[i]) p[++psize]=(Node){i,a[i]};
}
sort(p+1,p+psize+1);
// while(!p.empty())
// {
// int id=p.top().id;
// p.pop();
for (int i=1;i<=psize;i++){
int id=p[i].id;
int z=T1.qur(id);
int y=T3.qur(z);
//cout<<a[id]<<" "<<y<<endl;
if(!y)
{
cout<< "NO\n";
return ;
}
T3.del(y);
T1.up(0,id,1,1,n);
T2.up(1,id,1,1,n);
}
std::cout << "YES\n";
}
signed main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr), cout.tie(nullptr);
// T = 1;
cin>>T;
while(T--)
{
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 13828kb
input:
3 5 2 3 5 1 3 2 4 5 2 1 2 4 5 5 5 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5 3 2 2 3 1 2 3 2 2 3
output:
YES YES NO
result:
ok 3 lines
Test #2:
score: 0
Accepted
time: 2ms
memory: 15924kb
input:
100 2 1 2 2 1 2 1 1 2 1 2 1 2 1 2 2 2 1 1 1 2 1 2 6 1 5 3 4 2 5 6 1 3 5 2 1 1 1 6 1 6 2 1 3 6 4 5 1 4 1 2 2 1 4 3 3 2 2 1 3 2 1 3 2 2 1 1 1 1 1 1 1 1 1 1 1 1 2 1 2 2 1 2 1 2 4 4 3 2 1 3 4 2 1 3 4 4 3 1 1 1 1 1 1 1 6 5 1 6 2 5 4 3 1 6 2 4 3 1 4 1 1 1 1 1 1 6 5 3 3 6 1 4 5 2 3 6 1 4 2 3 3 4 4 3 4 3 4 ...
output:
YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES NO NO NO YES YES NO NO YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES NO YES YES YES YES YES YES YES NO YES YES YES YES YE...
result:
ok 100 lines
Test #3:
score: 0
Accepted
time: 2ms
memory: 13836kb
input:
99 6 1 6 1 5 3 4 2 6 1 1 2 1 1 1 6 1 1 1 1 1 1 4 1 3 3 4 1 2 1 1 1 2 2 2 1 2 1 2 1 2 1 1 1 1 1 1 2 1 2 1 2 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 3 2 2 3 2 1 2 1 1 2 3 3 1 2 3 1 2 3 1 1 6 1 5 3 4 2 5 6 1 3 4 2 1 1 1 6 4 4 1 6 5 2 3 4 1 2 3 4 5 4 4 6 2 1 1 1 2 1 1 6 5 1 2 1 4 5 6 3 2 1 4 6 3 2 6 3 6 5 6 2 1 3...
output:
YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO NO YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES YES NO NO YES YES YES NO YES YES YES NO YES YES NO YES NO YES NO YES YES YES YES YES YES NO YES NO NO YES YES YES YE...
result:
ok 99 lines
Test #4:
score: 0
Accepted
time: 0ms
memory: 15896kb
input:
98 6 1 6 6 1 4 5 2 3 3 1 2 2 1 1 6 4 3 2 2 3 4 1 2 1 3 3 4 1 1 1 1 1 1 6 1 6 6 4 3 1 2 5 1 3 1 3 1 1 5 1 1 1 1 1 1 6 4 4 3 4 1 2 5 6 3 4 1 2 2 4 3 1 6 5 1 4 5 3 6 1 2 4 5 3 1 2 6 1 1 1 1 1 1 5 1 4 1 3 2 4 5 1 5 3 4 4 6 3 4 1 4 2 3 6 5 1 2 5 5 4 6 5 4 1 3 2 1 4 3 2 1 1 1 1 1 1 1 1 1 6 3 5 5 1 3 6 4 2...
output:
YES NO YES YES YES YES YES YES NO NO YES YES NO YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES NO YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES NO YES YES YES YES YES NO YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES NO Y...
result:
ok 98 lines
Test #5:
score: 0
Accepted
time: 21ms
memory: 13956kb
input:
60000 1 1 1 1 1 1 1 1 1 1 1 1 3 2 1 2 3 1 2 1 2 3 3 1 1 2 3 1 2 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 3 2 3 2 1 3 2 1 1 1 2 2 1 2 1 2 1 1 1 1 1 1 1 1 2 2 1 1 2 1 2 1 1 1 1 1 1 1 3 1 3 2 3 1 1 2 3 2 3 3 2 2 3 1 2 3 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 3 2 3 3 2 1 2 1 1 2 1 3 2 2 1 3 2 3 2 3 ...
output:
YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES...
result:
ok 60000 lines
Test #6:
score: 0
Accepted
time: 21ms
memory: 13892kb
input:
50000 1 1 1 1 1 1 4 3 4 1 2 3 4 1 2 3 2 3 4 4 1 1 1 1 1 1 3 2 1 3 1 2 1 2 3 4 1 4 2 1 4 3 2 4 4 3 4 3 1 2 1 2 3 2 3 3 4 1 3 4 2 1 3 1 3 2 4 4 4 2 4 1 2 3 4 1 2 3 3 4 3 1 2 2 1 3 3 1 3 4 2 2 4 3 1 2 3 1 2 1 1 1 1 1 1 1 4 3 1 1 2 3 4 1 2 4 4 4 1 4 4 3 2 1 4 2 1 1 2 3 3 1 2 1 3 2 1 3 1 4 3 2 1 3 2 4 1 ...
output:
YES YES YES YES NO NO YES YES NO YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES NO YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES Y...
result:
ok 50000 lines
Test #7:
score: 0
Accepted
time: 18ms
memory: 13876kb
input:
40000 3 2 1 3 2 1 2 1 3 5 5 1 5 2 1 3 4 5 2 1 3 4 5 4 1 3 1 4 3 2 1 1 1 1 5 3 3 5 3 4 1 2 3 1 2 1 2 1 3 1 2 1 3 2 1 3 1 2 2 2 1 2 1 2 2 2 5 4 2 5 4 2 1 3 4 2 1 3 1 2 1 1 1 1 1 1 3 1 2 1 2 3 1 2 1 2 1 1 1 2 1 2 5 5 2 5 2 3 1 4 5 2 3 1 4 1 1 5 3 4 4 5 1 2 3 4 2 3 1 1 1 3 1 1 1 1 1 1 5 4 2 2 1 4 5 3 2 ...
output:
YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES NO YES YES YES YES YES YES YES NO NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES NO YES YES YES YES YES YES YES YES YES NO YES YES YES NO YES NO YES YES NO YES YES YES YES YES NO NO YES YES YES YES ...
result:
ok 40000 lines
Test #8:
score: 0
Accepted
time: 21ms
memory: 15916kb
input:
40000 6 3 5 3 6 2 5 1 4 3 2 1 1 2 3 6 1 4 3 1 1 3 4 2 1 3 2 1 1 1 1 1 1 1 1 1 1 1 1 1 6 2 6 4 1 3 2 6 5 2 5 6 5 5 3 5 5 6 6 2 3 6 2 5 1 4 3 6 2 5 1 4 6 4 2 2 1 1 2 1 2 2 2 2 1 1 2 1 2 1 3 3 3 2 1 3 2 1 3 2 3 1 6 4 5 5 1 3 4 6 2 5 1 3 2 5 5 4 3 4 6 2 4 4 3 5 6 2 1 4 3 2 2 1 1 3 1 2 2 3 1 1 2 2 3 3 1 ...
output:
YES YES YES YES NO YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES NO YES YES YES YES YES YES YES YES YE...
result:
ok 40000 lines
Test #9:
score: 0
Accepted
time: 23ms
memory: 13852kb
input:
40000 7 5 2 6 4 2 1 3 5 7 6 4 2 1 3 3 1 2 2 2 2 1 2 1 1 1 4 1 4 3 4 2 1 1 3 4 2 1 3 2 2 1 3 2 1 2 1 3 5 2 4 4 3 2 5 1 2 1 2 2 2 5 7 1 7 2 7 5 6 1 4 3 3 3 3 1 1 3 1 6 7 7 2 3 7 2 5 1 6 4 3 7 2 5 1 6 4 5 6 6 2 6 2 6 3 4 1 5 2 1 6 3 4 5 3 5 3 1 3 3 1 2 1 2 3 3 7 5 3 1 7 5 4 6 3 2 5 4 6 3 2 6 1 1 6 3 5 ...
output:
YES YES YES YES YES YES YES YES YES YES YES YES YES NO NO YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES NO YES YES NO YES YES YES YES YES YES YES NO YES YES YES NO YES YES YES YES YES YES YES YES NO YES YES YES YES YES NO YES YES NO YES YES NO YES YES ...
result:
ok 40000 lines
Test #10:
score: 0
Accepted
time: 24ms
memory: 13824kb
input:
40000 4 2 4 4 1 3 2 4 2 3 4 4 3 6 3 5 6 2 4 5 1 3 2 1 3 1 1 2 6 1 8 5 6 1 7 2 8 6 5 3 4 1 7 5 2 3 3 1 2 8 7 8 6 6 1 3 4 6 1 5 2 3 4 6 1 5 2 6 8 7 2 6 8 5 7 1 3 2 4 6 5 7 1 3 2 4 8 7 1 1 1 1 1 1 4 3 3 2 4 3 1 2 4 3 1 2 4 4 3 3 1 3 4 2 1 3 2 4 4 3 2 2 1 1 2 1 2 2 7 5 3 5 2 3 7 1 6 4 2 3 1 6 4 7 5 6 7 ...
output:
NO YES NO YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES NO YES NO YES YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES NO YES NO...
result:
ok 40000 lines
Test #11:
score: 0
Accepted
time: 27ms
memory: 15872kb
input:
40000 2 2 2 1 2 1 2 1 1 8 2 6 1 3 5 4 6 7 2 8 3 2 2 8 6 8 7 8 8 5 4 3 1 2 7 8 5 4 6 3 1 2 5 4 8 7 7 7 1 1 1 1 1 1 1 1 1 1 1 1 2 1 1 1 2 2 2 2 2 2 1 2 2 1 2 2 2 2 2 2 1 2 1 2 1 8 1 7 5 3 8 4 1 7 6 2 2 3 5 2 1 1 1 1 9 8 2 7 8 1 6 4 5 9 3 2 7 8 1 6 4 5 3 2 2 9 2 1 2 2 1 2 1 1 4 1 4 3 1 4 2 3 1 2 1 2 3 ...
output:
YES NO NO YES YES NO NO YES YES YES YES YES YES YES YES NO YES NO YES YES YES YES NO YES YES YES NO YES NO NO NO YES YES NO YES YES YES YES NO YES NO YES YES YES YES YES YES YES YES YES NO YES NO YES YES YES YES YES YES YES YES NO YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES NO YES YES...
result:
ok 40000 lines
Test #12:
score: 0
Accepted
time: 28ms
memory: 13852kb
input:
40000 1 1 1 1 1 1 7 5 4 7 4 6 2 5 1 3 7 4 6 2 1 1 2 3 7 7 4 3 7 4 1 3 2 5 6 1 3 2 5 6 5 7 7 1 6 5 4 3 1 7 2 6 6 4 2 3 1 1 1 4 3 4 2 4 3 1 2 3 1 2 3 3 3 3 1 3 3 1 2 2 1 3 3 1 1 1 1 1 1 2 1 1 1 2 1 2 9 2 8 9 8 6 4 2 1 5 7 3 4 1 1 2 2 3 5 4 2 9 1 1 1 1 1 1 4 2 3 2 4 3 1 2 1 3 2 4 3 3 3 1 3 2 1 3 2 3 3 ...
output:
YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES NO NO YES YES NO YES YES YES YES NO NO YES YES YES YES YES YES YES YES YES NO YES NO NO NO YES NO YES YES YES NO YES YES YES YES YES NO NO YES YES YES YES YES YES YES YES NO YES NO YES YES YES NO YES YES YES YES YE...
result:
ok 40000 lines
Test #13:
score: 0
Accepted
time: 33ms
memory: 13836kb
input:
40000 6 3 5 4 3 2 5 1 6 2 3 1 2 1 1 6 6 2 1 1 1 2 1 1 6 5 4 1 3 5 6 2 4 1 3 6 2 4 2 2 6 6 8 2 7 5 8 4 7 1 3 2 6 6 2 1 3 1 1 1 1 7 1 1 1 1 1 1 11 6 5 2 4 11 6 9 3 8 1 7 5 10 2 4 3 6 8 5 3 1 4 1 1 8 3 8 6 4 8 5 1 3 7 2 4 1 2 2 2 1 3 3 4 8 4 2 1 2 2 1 1 2 2 5 5 1 1 5 3 4 2 1 5 3 4 2 5 9 2 9 8 7 5 6 2 4...
output:
NO YES YES NO YES NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES NO YES YES YES YES NO YES NO NO YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES NO YES NO YES YES YES YES YES YES NO YES YES YES YES YES YES NO NO YES NO YES YES YES YES...
result:
ok 40000 lines
Test #14:
score: 0
Accepted
time: 36ms
memory: 15872kb
input:
40000 5 4 3 1 5 4 2 3 1 4 2 3 1 5 4 12 1 12 8 11 5 1 7 3 10 6 4 9 12 2 4 3 6 2 1 1 2 9 11 12 10 11 12 2 2 1 2 1 2 1 2 4 3 4 2 3 4 1 2 3 1 2 2 1 3 2 2 1 2 1 2 1 2 6 4 5 2 5 3 4 1 6 2 3 1 6 3 6 6 3 6 4 4 1 3 4 1 2 3 4 1 2 2 3 1 2 3 2 1 1 3 3 11 8 4 11 3 10 5 1 6 4 8 7 9 2 11 3 1 6 4 7 9 2 10 8 11 10 1...
output:
YES NO YES YES YES YES YES NO NO YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES YES YES YES YES YES YES YES YES NO YES YES NO YES YES YES YES NO YES YES NO YES YES YES YES NO YES YES YES YES NO YES YES YES YES YES NO YES NO YES YES YES YES YES YES YES NO YES YE...
result:
ok 40000 lines
Test #15:
score: 0
Accepted
time: 12ms
memory: 13896kb
input:
10000 10 5 6 5 6 9 10 7 1 3 2 4 8 5 6 9 1 2 8 9 9 10 10 10 10 6 5 5 6 7 2 4 8 10 9 1 3 5 2 8 9 1 3 9 7 7 10 10 5 3 4 3 5 4 1 2 4 1 2 3 5 4 5 6 3 5 6 1 2 5 4 3 1 4 3 4 5 5 5 4 10 8 5 7 3 1 5 9 8 2 6 10 4 3 1 5 9 8 2 6 4 6 1 4 8 10 10 6 4 7 1 4 5 8 9 3 10 2 6 1 4 8 3 2 6 2 1 2 1 10 3 10 9 6 4 7 2 5 8 ...
output:
NO NO NO NO YES YES NO YES YES YES NO NO YES YES YES NO NO YES YES YES YES NO YES YES NO YES YES YES YES YES YES YES YES YES NO YES YES YES NO YES YES YES NO YES YES NO YES YES YES YES NO NO YES YES YES NO NO NO YES YES YES YES YES YES NO YES YES NO YES YES YES NO YES NO NO NO YES YES NO YES YES YES...
result:
ok 10000 lines
Test #16:
score: 0
Accepted
time: 28ms
memory: 13856kb
input:
10000 15 15 1 15 6 5 8 3 2 12 9 10 1 4 7 14 11 13 15 6 5 8 3 2 12 9 10 1 4 7 14 11 13 10 8 3 6 5 6 2 4 1 3 8 7 6 1 7 7 7 8 8 8 7 19 1 19 7 10 13 3 5 16 12 17 19 8 1 2 11 18 6 14 9 15 4 1 4 8 1 1 5 1 1 3 2 5 2 2 1 17 18 18 18 17 18 20 11 12 5 14 20 19 1 10 8 3 13 15 4 2 16 18 7 6 17 9 11 12 5 14 10 8...
output:
YES NO NO NO YES YES YES YES NO NO NO NO YES NO NO NO NO YES NO YES NO NO YES YES YES NO NO NO YES NO NO NO YES YES YES YES YES YES YES NO YES YES YES NO YES NO YES YES YES YES NO NO YES YES YES NO YES NO YES YES YES YES YES YES YES NO YES YES YES NO NO NO NO NO YES NO NO YES YES YES NO NO YES YES Y...
result:
ok 10000 lines
Test #17:
score: 0
Accepted
time: 80ms
memory: 15908kb
input:
10000 4 3 4 1 4 3 2 1 3 2 2 4 3 4 1 1 1 1 1 1 79 70 9 73 34 21 66 52 46 72 32 63 44 48 11 77 40 15 51 50 67 70 53 62 3 31 69 20 41 28 30 54 10 7 19 24 74 5 4 59 1 18 37 68 25 23 58 6 33 65 55 43 39 17 12 49 35 56 8 75 64 45 14 36 22 13 57 60 27 71 61 42 9 76 2 16 79 78 26 38 47 29 73 34 21 66 52 46 ...
output:
YES YES YES NO YES NO YES YES YES NO YES NO NO YES YES YES YES NO YES NO NO YES YES YES NO NO YES NO YES YES YES YES YES YES YES YES NO NO YES NO YES NO YES NO YES YES YES YES YES NO YES YES NO NO YES NO YES NO YES NO NO NO YES YES YES YES YES NO YES NO NO YES YES YES YES YES YES YES YES YES NO YES ...
result:
ok 10000 lines
Test #18:
score: 0
Accepted
time: 464ms
memory: 16924kb
input:
10 10201 2518 7686 8039 7511 4669 4613 6162 1290 9288 8391 4993 2070 8427 2499 3018 4916 4911 6060 8440 8901 8250 8997 3347 142 4313 3070 4228 9879 9075 2665 5642 762 2855 9465 1799 10036 6353 2529 8827 686 3883 6577 1430 5052 8277 6025 3863 8054 2652 618 8088 8364 3502 7890 391 9096 8691 919 6628 5...
output:
NO NO YES YES YES NO YES NO YES NO
result:
ok 10 lines
Test #19:
score: 0
Accepted
time: 537ms
memory: 16440kb
input:
20 3517 1806 1714 2427 3145 194 284 2676 2141 2910 1618 2873 1968 40 243 1537 1591 1601 2415 4 3510 2693 406 2190 1132 2469 2613 1250 779 922 1718 1695 2492 993 1755 401 2836 852 3047 2043 3222 894 2147 694 648 3231 3218 1357 1075 1493 2303 9 1948 2212 2702 1547 2074 2697 158 686 3377 580 561 3256 2...
output:
NO NO NO NO YES YES YES YES NO YES YES YES YES NO NO NO NO NO YES NO
result:
ok 20 lines
Test #20:
score: 0
Accepted
time: 367ms
memory: 20464kb
input:
30 15323 12316 3009 5461 8905 8847 12520 7056 5196 2078 6413 10193 12294 4601 3990 3691 6826 1631 4736 1507 5339 9776 3413 3135 4489 6794 9471 862 9813 7867 1310 6835 13073 14303 6260 7845 1433 619 4653 10981 8986 4105 5834 14974 7877 11174 14863 3485 4000 5318 3431 9158 14662 4199 13232 11276 6580 ...
output:
YES NO YES NO NO NO YES NO NO NO NO YES YES YES NO YES YES NO YES NO YES NO YES NO YES NO YES NO NO YES
result:
ok 30 lines
Test #21:
score: -100
Time Limit Exceeded
input:
3 123075 23064 100012 93912 55885 25582 39571 6971 36425 111197 79711 41681 36088 693 117681 100171 12244 42071 77370 19600 53711 112897 110126 115034 42792 46276 8459 72493 52952 122924 83906 367 41855 74275 99613 118996 21890 122972 36973 76603 40716 7063 79518 4540 39960 38554 55233 19544 92392 3...