QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#399250 | #6748. Spin the Wheel | blhxzjr | WA | 0ms | 3848kb | C++20 | 822b | 2024-04-26 08:29:18 | 2024-04-26 08:29:18 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
#define endl '\n'
#define rep(i,a,n) for(int i=a;i<=n;i++)
#define int long long
int n,m,k,_;
const int N=1e5+7;
int a[N];
void main2(){
cin>>n;
rep(i,1,n){
cin>>a[i];
}
vector<int>d(n+1,0);
int sum=0;
int mx=-1;
int cnt=1;
rep(i,1,n){
if(i==1) d[i]=a[i]-a[n];
else d[i]=a[i]-a[i-1];
sum+=d[i];
if(i>1)
mx=max(mx,d[i]);
}
rep(i,1,n){
if((d[i]-mx)%n)
cout<<"-1"; return;
}
if(a[1]==0) cout<<mx;
else if(mx==0) cout<<n+1;
else cout<<mx+1;
}
signed main(){
ios::sync_with_stdio(false); cin.tie(0);
_=1;
//cin>>_;
while(_--){
main2();
if(_) cout<<endl;
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3848kb
input:
5 1 3 0 2 4
output:
result:
wrong answer Answer contains longer sequence [length = 1], but output contains 0 elements