| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 110933 | imsifile | On the Grid (FXCUP4_grid) | C++98 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "grid.h"
#include <vector>
#include <stdio.h>
using namespace std;
int N, rot[1010], sm[1010];
int Put(){
vector<int> v;
for(int i=0; i<N; i++) v.push_back(rot[i]);
return PutDisks(v)-N;
}
void Rotate(int X){
int tmp=rot[0];
for(int i=0; i<X-1; i++) rot[i]=rot[i+1];
rot[X-1]=tmp;
}
void SortDisks(int N_) {
N = N_;
for(int i=0; i<N; i++) rot[i]=i+1;
for(int i=N; i>1; i--){
while(1){
int x = Put(); Rotate(i);
if(x == i-1) break;
}
}
for(int i=0; i<N; i++) sm[rot[i]]=i+1;
for(int i=1; i<=N; i++) Report(sm[i]);
}
