QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#410785 | #6748. Spin the Wheel | sheppard23 | WA | 1ms | 3444kb | C++14 | 705b | 2024-05-14 14:52:01 | 2024-05-14 14:52:02 |
Judging History
answer
#include<bits/stdc++.h>
#define int long long
using namespace std;
const int N=1e7+10;
int a[N],p[N],ans[N];
int mod=998244353;
int qmid(int a,int b)
{
int res=1;
while(b)
{
if(b&1)
res=res*a%mod;
a=a*a%mod;
b>>=1;
}
return res;
}
signed main()
{
int n;
cin>>n;
int ans=0;
map<int,int>mp;
for(int i=1;i<=n;i++)
{
cin>>a[i];
mp[a[i]]++;
if(i>1)
{
if(a[i]>a[i-1])
ans=a[i]-a[i-1];
}
}
if(mp.size()!=n)
{
cout<<-1<<endl;
return 0;
}
if(a[0]!=0)
ans++;
cout<<ans<<endl;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3444kb
input:
5 1 3 0 2 4
output:
2
result:
wrong answer 1st numbers differ - expected: '3', found: '2'