QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#403446#6748. Spin the WheelCCF_NOI#WA 6ms2012kbC++14506b2024-05-02 13:16:482024-05-02 13:16:49

Judging History

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

  • [2024-05-02 13:16:49]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:2012kb
  • [2024-05-02 13:16:48]
  • 提交

answer

#include<cstdio>
using namespace std;
const int N=1e5+10;
int n,a[N],k;
int jian(int i){
	if(a[i+1]<a[i])return a[i+1]+n-a[i];
	return a[i+1]-a[i];
}
int main(){
	scanf("%d",&n);
	for(int i=0;i<n;++i)scanf("%d",&a[i]);
	int k=jian(0);
	for(int i=1;i<n-1;++i)if(k!=jian(i)){
		printf("-1");
		return 0;
	}
	if(k>=2){
		printf("%d",k*2-1);
		return 0;
	}
	if(k==1){
		printf("%d",a[0]==0?1:2);
		return 0;
	}
	if(k==0){
		printf("%d",a[0]==0?0:-1);
		return 0;
	}
	return 0;
} //

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 1616kb

input:

5
1 3 0 2 4

output:

3

result:

ok 1 number(s): "3"

Test #2:

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

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:

111109

result:

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