This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <stdio.h>
int a[31],p;
int main(){
int i,n;
scanf("%d",&n);
for(i=0;i<n;++i){
while(a[p])p=(p+1)%n;
scanf("%d",a+p);
p=(p+a[p])%n;
}
if(i<n)puts("-1");
else{
printf("%d\n",n);
for(i=0;i<n;++i)printf("%d ",a[i]);
}
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |