QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#371716#6748. Spin the WheelswimsealCompile Error//C++141000b2024-03-30 15:10:162024-03-30 15:10:36

Judging History

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

  • [2024-03-30 15:10:36]
  • 评测
  • [2024-03-30 15:10:16]
  • 提交

answer

#include <bits/stdc++.h>

#define x first
#define y second
#define pb push_back 
#define int long long

using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
typedef pair<double, double> pdd;
 
const int N = 2e6 + 10;
const double eps = 1e-9;

int n;
int a[N];
void solve(){
	cin >> n;
	int maxv = 0, minn = 1e8;
	for (int i = 0; i < n ; i ++){
		cin >> a[i];
a[i + n] = a[i];
		maxv = max(a[i], maxv);
		minn = min(a[i], minn);
	} 
	if(maxv == minn){
		if(minn == 0){
			cout << 0 << endl;
		}
		else if(minn == n - 1 && n % 2 == 0){
			cout << n << endl;
		}
		else puts("-1");
		return;
	}
	
	int id = 0;
	while(a[id] != 0) id ++;
	int cnt = a[id + 1];
	//6cout << a[id + 1] << endl;

	for (int i = id,t = 0; i < id + n; i ++,t ++){
		if(a[i] = (1ll* t * cnt) % n){
			puts("-1");
			return;
		}	
	}
	if(id != 0) cnt ++;
	cout << cnt << endl;

	
}

signed main(){
	int t = 1;// cin >>t;
	while(t --) solve();
	return 0;
}

Details

answer.code: In function ‘void solve()’:
answer.code:22:28: error: expected ‘;’ before ‘;’
   22 |                 cin >> a[i];
      |                            ^~
      |                            ;