QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#407321#6748. Spin the WheelSanCai#WA 6ms6600kbC++141.1kb2024-05-08 15:35:032024-05-08 15:35:03

Judging History

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

  • [2024-05-08 15:35:03]
  • 评测
  • 测评结果:WA
  • 用时:6ms
  • 内存:6600kb
  • [2024-05-08 15:35:03]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define lowbit(x) ((x)&(-x))
#define endl '\n'
#define sc scanf
#define pt printf
#define YES cout<<"YES"<<endl;
#define NO cout<<"NO"<<endl;
#define ls k+k
#define rs k+k+1
using pll = pair<ll, ll>;
using pii = pair<int, int>;
const int N = 1e7 + 10;
const ll p=998244353;
ll a[N],b[N];
void UraykevoliQwQ()
{
	int n;cin>>n;
	for(int i=1;i<=n;i++)
	{
		cin>>a[i];
	}
	set<int>st;
	for(int i=1;i<n;i++)
	{
		int d=a[i+1]-a[i];
		st.insert(d);
	}
	//for(auto it:st)cout<<it<<' ';
	if(st.size()>2)cout<<-1;
	else
	{
		int d=min(abs(*st.begin()),abs(*st.rbegin()));
		for(int i=1;i<=n;i++)
		{
			b[i]=d*(i-1)%n;
		}
		bool f=0;
		//for(int i=1;i<=n;i++)cout<<b[i]<<' ';
		for(int i=1;i<=n;i++)
		{
			if(a[i]!=b[i])
			{
				f=1;
				break;
			}
		}
		if(f)cout<<d+1;
		else cout<<d;
	}
}
int main()
{
	ios::sync_with_stdio(false), cin.tie(nullptr), cout.tie(nullptr);
	//int _;cin>>_;while(_--)
	UraykevoliQwQ();
	return 0;
}

詳細信息

Test #1:

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

input:

5
1 3 0 2 4

output:

3

result:

ok 1 number(s): "3"

Test #2:

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

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:

44446

result:

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