QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#411607#6748. Spin the WheelzhangmeixingWA 1ms3596kbC++23892b2024-05-15 16:35:462024-05-15 16:35:47

Judging History

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

  • [2024-05-15 16:35:47]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3596kb
  • [2024-05-15 16:35:46]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define int long long
#define inf 1e18
#define rep(i, l, n) for (int  i = l; i <= n; i++)
#define per(i, l, n) for (int  i = n; i >= l; i--)
//cout<<fixed<<setprecision(15)
const int mol=998244353;
const int N = 3e5+10,M=5010;
int qmi(int a,int k){int res=1;while(k){if(k&1)res=res*a%mol;a=a*a%mol;k>>=1;}return res;}
int inv(int x){return qmi(x%mol,mol-2);}
int n,m,q,k;
int a[N];
void solve()
{
  cin>>n;
  rep(i,1,n)cin>>a[i];
  m=(a[1]-a[0]+n)%n;
  rep(i,1,n-1)
  {
    if((a[i+1]-a[i]+n)%n!=m)
    {
      cout<<-1<<endl;
      return ;
    }
  }
  if(!a[0]){cout<<m<<endl;
  return ;
  }
  if(!m)m+=n;
  cout<<m+1<<endl;
}
signed main()
{
  ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
  int T = 1;
   //cin>>T;
  for (int i = 1; i <= T; i++)solve();
  return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3596kb

input:

5
1 3 0 2 4

output:

-1

result:

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