QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#412440#6736. Alice and BobXiaoretaW#WA 0ms3804kbC++14676b2024-05-16 14:23:572024-05-16 14:23:58

Judging History

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

  • [2024-05-16 14:23:58]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3804kb
  • [2024-05-16 14:23:57]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define ll long long

int main() {
    int n;
    cin>>n;
    vector<int> a(n+1);
    for(int i=0;i<n;i++){
        cin>>a[i];
    }
    a[n]=a[0];
    int ans=a[1]-a[0];
    if(a[1]<a[0])ans+=n;
    bool ok=1;
    for(int i=1;i<=n;i++){
        if(a[i]!=(a[i-1]+ans)%n){
            ok=false;
            break;
        }
    }
    if(ok){
        if(a[0]==ans){
            cout<<ans<<'\n';
        }
        else {
            if(ans==1){
                cout<<n+2<<'\n';
            }
            else
            cout<<ans+1<<'\n';
        }
    }
    else cout<<-1<<'\n';

    return 0;
}

详细

Test #1:

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

input:

1

output:

0

result:

wrong answer 1st numbers differ - expected: '1', found: '0'