QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#407364#6748. Spin the Wheeltjf4#WA 1ms3760kbC++20737b2024-05-08 16:40:242024-05-08 16:40:25

Judging History

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

  • [2024-05-08 16:40:25]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3760kb
  • [2024-05-08 16:40:24]
  • 提交

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'