# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
243260 | Kubin | 게임 (IOI14_game) | C++11 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include <ext/numeric>
#ifndef XHOVA
#include "gondola.h"
#endif
using namespace std;
using __gnu_cxx::power;
void normalize(int n, int A[])
{
int k = -1;
for(int i = 0; i < n and k == -1; i++)
if(A[i] <= n)
k = (n + i - (A[i]-1)) % n;
if(k != -1)
rotate(A, A + k, A + n);
}
int valid(int n, int A[])
{
normalize(n, A);
for(int i = 0; i < n; i++)
if(A[i] <= n and A[i]-1 != i)
return false;
return unordered_set<int>(A, A + n).size() == (size_t)n;
}
int replacement(int n, int A[], int out[])
{