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> 
#include <stdlib.h> 
#include <string.h> 
#include <memory.h> 
#include <math.h> 
#include <assert.h> 
#include <stack> 
#include <queue> 
#include <map> 
#include <set> 
#include <algorithm> 
#include <string> 
#include <functional> 
#include <vector> 
#include <deque> 
#include <utility> 
#include <bitset> 
#include <limits.h>  
using namespace std; 
typedef long long ll; 
typedef unsigned long long llu; 
typedef double lf;
typedef unsigned int uint;
typedef long double llf;
typedef pair<int, int> pii;
int N;
int A[101], R[101];
int main() {
	int i, j, k;
	scanf("%d",&N);
	for(i=0; i<N;i++) scanf("%d", R+i);
	printf("%d\n", N);
	
	int count = 0, from = 0, value = R[0];
	while(count < N) {
		while(A[from] != 0) from = (from+1) % N;
		A[from] = R[count];
		from = (R[count] + from) % N;
		count++;
	}
	for(i = 0; i < N; i++) printf("%d ", A[i]);
    
	//printf("%d\n", from);
	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... |