QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#244525 | #5750. Siteswap | ucup-team870# | WA | 1ms | 3592kb | C++14 | 916b | 2023-11-09 11:12:22 | 2023-11-09 11:12:24 |
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",x,y,z);
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3592kb
input:
3 3 1 5 0 6 4 6 4 0 4 0 2 6 4
output:
0 0 2 1 2 0 2 3 0
result:
wrong answer 4th numbers differ - expected: '2', found: '1'