QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#408584#6748. Spin the WheelBeaterWA 0ms3496kbC++23562b2024-05-10 18:59:462024-05-10 18:59:46

Judging History

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

  • [2024-05-10 18:59:46]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3496kb
  • [2024-05-10 18:59:46]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
int n,ans,a[100010],mi,mx;
int main()
{
    cin>>n;
    mi=n;
    mx=0;
    for(int i=1;i<=n;i++) 
    {
        cin>>a[i];
        mi=min(mi,a[i]);
        mx=max(mx,a[i]);
    }
    if(mi==mx)
    {
        if(mi==0) ans=0;
        else ans=n+1;
        cout<<ans<<"\n";
        return 0;
    }
    else 
    {
        set<int>s;
        for(int i=1;i<=n;i++) s.insert((a[i+1]-a[i]+n)%n);
        if(s.size()==1) if(a[1]!=0) ans++;
        ans+=*s.begin();
    }
    cout<<ans<<"\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

5
1 3 0 2 4

output:

1

result:

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