QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#386892#6748. Spin the WheelArnold_6#RE 0ms0kbC++14532b2024-04-11 21:07:152024-04-11 21:07:16

Judging History

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

  • [2024-04-11 21:07:16]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-04-11 21:07:15]
  • 提交

answer

#include<bits/stdc++.h>
#define int long long
using namespace std;
int n,ans,rst;
int a[100010],b[100010];
signed main(){
    scanf("%lld",&n);
    for(int i=1;i<=n;++i)   scanf("%lld",a+i);
    for(int i=1;i<=n;++i)   b[i]=a[i%n+1]-a[i];
    rst=ans=(b[1]+n)%n;
    for(int i=1;i<=n;++i){
        // cout<<i<<" "<<b[i]<<endl;
        if(((b[i]+n)%n!=rst)||(rst==0&&a[i]!=0)){
            puts("-1");
            return 0;
        }
    }
    if(a[1]!=0) ans++;
    printf("%lld",ans);  
    system("pause");
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Dangerous Syscalls

input:

5
1 3 0 2 4

output:


result: