QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#407325 | #6748. Spin the Wheel | SanCai# | WA | 1ms | 5504kb | C++14 | 1.1kb | 2024-05-08 15:42:03 | 2024-05-08 15:42:04 |
Judging History
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+2;
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: 0
Wrong Answer
time: 1ms
memory: 5504kb
input:
5 1 3 0 2 4
output:
4
result:
wrong answer 1st numbers differ - expected: '3', found: '4'