Wrong Answer
Code
#include<bits/stdc++.h>
using namespace std;
int main()
{
int t;
cin>>t;
while(t--)
{
int n,m;
cin>>n>>m;
int a[n+2],b[m+2];
set<int>s1;
for(int i=0;i<n;i++)
{
cin>>a[i];
s1.insert(a[i]);
}
set<int>s2;
for(int i=0;i<m;i++)
{
cin>>b[i];
s2.insert(b[i]);
}
if(s1.size()==10)
{
int val=0,flag=0;
for(auto it: s2)
{
if(it!=val && val<=3)
{
flag=1;
break;
}
else if( it==val && val<=3)
{
val++;
}
else
{
break;
}
}
if(flag==1)
{
cout<<"NO"<<endl;
}
else
{
cout<<"YES"<<endl;
}
}
else if(s2.size()==10)
{
int val=0,flag=0;
for(auto it: s1)
{
if(it!=val && val<=3)
{
flag=1;
break;
}
else
{
val++;
}
if(val>3) break;
}
if(flag==1)
{
cout<<"NO"<<endl;
}
else
{
cout<<"YES"<<endl;
}
}
else
{
cout<<"NO"<<endl;
}
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1153 Is Date Possible?
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2025-01-03 19:03:51
- Judged At
- 2025-01-03 19:03:51
- Judged By
- Score
- 40
- Total Time
- 35ms
- Peak Memory
- 1.285 MiB