QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#360342#6784. Problem PreparationXiangmy#WA 0ms3948kbC++20743b2024-03-21 17:39:072024-03-21 17:39:08

Judging History

你现在查看的是最新测评结果

  • [2024-03-21 17:39:08]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3948kb
  • [2024-03-21 17:39:07]
  • 提交

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,sign1=0,sign2=1,sum[10010];
        scanf("%d",&n);
        if(n<10||n>13){printf("No\n");continue;}
        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){printf("No\n");continue;}
        if(sign1){printf("No\n");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){printf("No\n");sign2=0;break;}
        }
        if(sign2){printf("Yes\n");}
    }
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3948kb

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
No
No
No
No
No
No

result:

wrong answer 3rd lines differ - expected: 'Yes', found: 'No'