QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#360329 | #6784. Problem Preparation | kden | WA | 7ms | 3820kb | C++14 | 716b | 2024-03-21 17:27:07 | 2024-03-21 17:27:07 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
int main(){
int t,n,s[10010];
scanf("%d",&t);cin.get();
while(t--){
int num=0,max1=-2000,tei,sign1=0,sign2=1,sum[10010];
scanf("%d",&n);
for(int i=1;i<=n;i++){
scanf("%d",&s[i]);
if(s[i]==1){num++;}
if(s[i]<1){sign1=1;}
}
if(num<2){cout<<"No"<<endl;continue;}
if(sign1){cout<<"No"<<endl;continue;}
sort(s+1,s+n+1);
for(int i=2;i<=n;i++){
sum[i]=abs(s[i]-s[i-1]);
if(i==n){sum[i]=1;}
if(sum[i]>2){cout<<"No"<<endl;sign2=0;break;}
}
if(sign2){cout<<"Yes"<<endl;}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3696kb
input:
8 9 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 6 7 8 9 10 11 999 1 1 2 3 4 5 6 7 8 9 11 999 1 3 5 7 9 11 13 17 19 21 10 15 1 13 17 1 7 9 5 3 11 13 1 1 1 1 1 1 1 1 1 1 1 1 2 10 2 3 4 5 6 7 8 9 10 11 10 15 1 13 3 6 5 4 7 1 14
output:
No No Yes No Yes Yes No No
result:
ok 8 lines
Test #2:
score: -100
Wrong Answer
time: 7ms
memory: 3820kb
input:
10000 9 1 1 1 1 1 1 1 1 2 10 1 1 1 1 1 1 1 1 1 2 10 0 1 1 1 1 1 1 1000 1 1 11 1 2 3 4 5 6 7 8 9 10 11 11 1 1 2 3 4 5 6 7 8 9 10 11 -1 1 1 1 1 1 1 1 2 1 1 11 1 1 3 5 7 9 11 13 15 17 19 12 1 1 3 5 7 9 11 13 15 17 19 1000 12 1 2 3 5 7 9 11 13 15 17 19 1000 11 1 1 2 3 4 5 6 9 11 17 22 13 10 1 5 9 10 5 7...
output:
Yes Yes No No Yes No Yes Yes No No No No No No No No No No No No No Yes No Yes No No No No No No No No No No No No No No No Yes No No No No No No No Yes No No No No No Yes No No No Yes No No Yes No No Yes No Yes No No No No No No No No No No No No No No No No Yes No No Yes Yes No No No No No No No N...
result:
wrong answer 1st lines differ - expected: 'No', found: 'Yes'