QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#411607 | #6748. Spin the Wheel | zhangmeixing | WA | 1ms | 3596kb | C++23 | 892b | 2024-05-15 16:35:46 | 2024-05-15 16:35:47 |
Judging History
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'