QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#244527 | #5750. Siteswap | ucup-team870# | WA | 0ms | 3876kb | C++14 | 916b | 2023-11-09 11:13:01 | 2023-11-09 11:13:02 |
Judging History
answer
#include<bits/stdc++.h>
#define For(i,j,k) for(int i=j;i<=k;++i)
using namespace std;
typedef long long ll;
int a[100005]; bool fl[100005];
int main(){
int _; scanf("%d",&_);
while(_--){
int n; scanf("%d",&n);
For(i,0,n-1) scanf("%d",&a[i]),fl[i]=0;
//
ll x=0,y=0,z=0;
For(i,0,n-1) if (a[i]&&!fl[i]){
ll cnt=0,st=i,now=i; fl[i]=1;
while(1){
cnt+=a[now]; now=(now+a[now])%n;
if (!a[now]) exit(24442226);
if (fl[now]){
if (now!=st) exit(466616666);
break;
}
fl[now]=1;
}
//ans
cnt=cnt/n;
if (a[i]%2==1) z+=cnt;
else if (i%2==1) x+=cnt;
else y+=cnt;
}
printf("%lld %lld %lld\n",y,x,z);
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3860kb
input:
3 3 1 5 0 6 4 6 4 0 4 0 2 6 4
output:
0 0 2 2 1 0 3 2 0
result:
ok 9 numbers
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3876kb
input:
100 10 94 8 4 52 7 53 16 96 29 1 10 23 35 96 34 86 39 16 72 63 96 10 51 2 46 21 15 31 41 28 42 83 10 75 67 64 88 46 98 3 17 14 98 10 24 77 54 48 16 37 23 88 99 84 10 52 93 44 87 84 80 37 22 73 28 10 35 80 96 60 75 19 100 63 54 88 10 38 49 63 68 29 67 3 57 68 48 10 89 57 51 21 61 16 100 73 99 83 10 6...
output:
13 23 0 0 0 56 0 0 36 0 0 57 4 0 51 22 13 25 25 14 28 36 0 13 10 0 55 15 0 15 9 0 48 35 0 13 15 11 22 0 7 34 9 0 39 30 7 0 38 0 27 6 10 49 28 5 10 0 0 45 7 26 22 8 0 46 7 64 0 24 19 0 0 0 57 0 13 28 9 1 37 0 0 58 7 16 22 0 0 40 6 6 21 3 36 4 3 38 23 25 9 10 19 49 0 0 3 51 22 8 29 0 8 40 7 0 51 0 0 4...
result:
wrong answer 1st numbers differ - expected: '2', found: '13'