QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#409720#6748. Spin the Wheelasoulcoming#WA 11ms6188kbC++201.4kb2024-05-12 16:37:092024-05-12 16:37:11

Judging History

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

  • [2024-05-12 16:37:11]
  • 评测
  • 测评结果:WA
  • 用时:11ms
  • 内存:6188kb
  • [2024-05-12 16:37:09]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
//upper_bound	>
//lower_bound	>=
#define LL long long
#define ULL unsigned long long
#define PII pair<int,int>
#define YES cout<<"YES\n"
#define NO cout<<"NO\n"
#define PI acos(-1)
#define endl '\n'
#define ee cout<<'\n';
#define __lcm(a, b) a*b/__gcd(a,b)
#define fo(a,b,c) for(int a=b;a<=c;a++)
#define of(a,b,c) for(int a=b;a>=c;a--)
#define debug(x) cout<<#x<<' '<<x<<endl;
#define nep next_permutation
#define prep prev_permutation
#define g(a) a,vector<a>,greater<a>
#define all(a) a.begin(),a.end()
#define alls(a) a.begin()+1,a.end()
#define int long long
//const int p = 998244353, pp = 1000000007;
LL qmi(LL a,LL b,LL mod){LL res=1;while(b){if(b&1)res=res*a%mod;b>>=1;a=a*a%mod;}return res;	}
const int N = 2000010, M = 4000010;
int a[N];
int c[N];
void solve()
{
	int n;
	cin >> n;
	int idx = -1;
	for (int i = 0; i < n; i ++)
	{
		cin >> a[i];
		if (a[i] == 0) idx = i;
	}
	vector<int> b;
	for (int i = 0; i < n; i ++)
	{
		b.push_back(a[(i + idx) % n]);
	}
	int c = b[1] - b[0];
	for (int i = 1; i < n - 1; i ++)
	{
		if ((b[i] + c) % n == b[i + 1]) continue;
		else 
		{
			cout << -1;
			return;
		}
	}
	if (idx == 0) cout << c;
	else cout << c + 1;
	
}
signed main()
{
 	ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
	//int T; cin >> T; while (T --)
	solve();
}













Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 5676kb

input:

5
1 3 0 2 4

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: -100
Wrong Answer
time: 11ms
memory: 6188kb

input:

100000
0 55555 11110 66665 22220 77775 33330 88885 44440 99995 55550 11105 66660 22215 77770 33325 88880 44435 99990 55545 11100 66655 22210 77765 33320 88875 44430 99985 55540 11095 66650 22205 77760 33315 88870 44425 99980 55535 11090 66645 22200 77755 33310 88865 44420 99975 55530 11085 66640 221...

output:

55556

result:

wrong answer 1st numbers differ - expected: '55555', found: '55556'