QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#396835#6748. Spin the WheelfangzWA 6ms5180kbC++141.1kb2024-04-23 11:21:222024-04-23 11:21:24

Judging History

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

  • [2024-04-23 11:21:24]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:5180kb
  • [2024-04-23 11:21:22]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define LL long long
#define pb push_back
#define x first
#define y second 
#define endl '\n'
const LL maxn = 4e05+7;
const LL N = 5e05+10;
const LL mod = 1e09+7;
const int inf = 0x3f3f3f3f;
const LL llinf = 5e18;
typedef pair<int,int>pl;
priority_queue<LL , vector<LL>, greater<LL> >mi;//小根堆
priority_queue<LL> ma;//大根堆
LL gcd(LL a, LL b){
	return b > 0 ? gcd(b , a % b) : a;
}

LL lcm(LL a , LL b){
	return a / gcd(a , b) * b;
}
int n , m;
vector<int>a(N , 0);
void init(int n){
	for(int i = 0 ; i <= n ; i ++){
		a[i] = 0;
	}
}
void solve() 
{
	cin >> n;
	for(int i = 0 ; i < n ; i ++){
		cin >> a[i];
	}	
	a[n] = a[0];
	for(int i = 1 ; i <= n ; i ++){
		if(a[i] < a[i - 1]){
			int k = (a[i - 1] - a[i] - 1 + n) / n;
			a[i] += k * n; 
		}
		if(a[i] - a[i - 1] != a[1] - a[0]){
			cout << -1;
			return;
		}
	}
	cout <<(a[1] - a[0]) * 2 - 1;
}            
int main() 
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    cout.precision(10);
    int t=1;
	//cin>>t;
    while(t--)
    {
    	solve();
    }
    return 0;
}

詳細信息

Test #1:

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

input:

5
1 3 0 2 4

output:

3

result:

ok 1 number(s): "3"

Test #2:

score: -100
Wrong Answer
time: 6ms
memory: 5108kb

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:

-1

result:

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