QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#372405 | #6748. Spin the Wheel | huanshao# | WA | 10ms | 4476kb | C++14 | 1.0kb | 2024-03-31 13:02:23 | 2024-03-31 13:02:24 |
Judging History
answer
/**
* author: Huan
* 躺平日记
* created: 2024-03-31 12:14:08
**/
#include <bits/stdc++.h>
#define ll long long
using namespace std;
const int mod = 1e9 + 7;
const int N = 1e6 + 10;
void solve()
{
int n;
cin >> n;
vector<int>v(n);
set<int>se;
int idx;
for(int i = 0 ;i < n ;i ++)
{
cin >> v[i];
if (v[i] == 0){
idx = (i + 1) % n;
}
se.insert(v[i]);
}
// if (se.size() == 1 && v[0] == 0){
// cout << 0 << endl;
// return ;
// }
if (se.size() == 1){
cout << n + 1 << endl;
return ;
}
if (se.size() != n){
cout << -1 << endl;
return ;
}
int sum = v[idx];
if (idx != 1){
sum ++ ;
}
cout << sum << endl;
}
signed main(void) {
ios_base::sync_with_stdio(false);
cin.tie(NULL); cout.tie(NULL);
int tt = 1; //cin >> tt;
while(tt -- ) solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3608kb
input:
5 1 3 0 2 4
output:
3
result:
ok 1 number(s): "3"
Test #2:
score: -100
Wrong Answer
time: 10ms
memory: 4476kb
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'