| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1304226 | activedeltorre | Gondola (IOI14_gondola) | C++20 | 0 ms | 0 KiB |
#include "gondola.h"
#include<map>
using namespace std;
map<int,int>fre;
int valid(int n, int inputSeq[])
{
int offset=-1,val,off2;
fre.clear();
for(int i=1;i<=n;i++)
{
val=inputSeq[i-1];
fre[val]++;
if(fre[val]>=2)
{
return 0;
}
if(val<=0)
{
return 0;
}
if(val<=n && offset==-1)
{
offset=(i-val+n)%n;
}
else if(val<=n)
{
off2=(i-val+n)%n;
if(off2!=offset)
{
return 0;
}
}
}
return 1;
}
