QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#407364 | #6748. Spin the Wheel | tjf4# | WA | 1ms | 3760kb | C++20 | 737b | 2024-05-08 16:40:24 | 2024-05-08 16:40:25 |
Judging History
answer
#include<bits/stdc++.h>
#define IOS ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
using namespace std;
typedef double db;
typedef long long ll;
typedef pair<ll,ll> pii;
typedef vector<pii> vii;
typedef vector<ll> vi;
typedef vector<string> vs;
typedef vector<char> vc;
const int inf=0x3f;
const int N=2e5+10;
const int mod=998244353;
ll n,p[N];
vi g;
int main() {
cin>>n;
for(int i=1;i<=n;i++) {
cin>>p[i];
g.push_back(p[i]);
}
sort(g.begin(),g.end());
if(g[0]==g.back()) {
if(g[0]==0) cout<<0;
else cout<<n;
return 0;
}
set<ll> st;
for(int i=2;i<=n;i++) {
ll x=(p[i]-p[i-1]+n)%n;
st.insert(x);
}
if(st.size()==1) cout<<*st.begin()<<endl;
else cout<<-1;
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3760kb
input:
5 1 3 0 2 4
output:
2
result:
wrong answer 1st numbers differ - expected: '3', found: '2'