QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#399236 | #6748. Spin the Wheel | blhxzjr | WA | 1ms | 3824kb | C++20 | 822b | 2024-04-26 08:06:30 | 2024-04-26 08:06:30 |
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
#define none 1e9*(-1)
int n,m,k,_;
constexpr int mx=(1<<17);
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);
vector<int>d1(n+1,1);
d1[n]=1-n;
int sum=0;
int mx=-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];
d[i]=abs(d[i]-d1[i]);
mx=max(d[i],mx);
}
if(sum!=0){
cout<<"-1"; return;
}
cout<<mx;
}
signed main(){
ios::sync_with_stdio(false); cin.tie(0);
_=1;
//cin>>_;
while(_--){
main2();
if(_) cout<<endl;
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3824kb
input:
5 1 3 0 2 4
output:
6
result:
wrong answer 1st numbers differ - expected: '3', found: '6'