Submission #4472

#TimeUsernameProblemLanguageResultExecution timeMemory
4472tncks0121입력숫자 (KOI13_mystery)C++98
100 / 100
0 ms1088 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...