# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
896765 | LCJLY | 곤돌라 (IOI14_gondola) | C++14 | 0 ms | 0 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
int valid(int n, int arr[]){
unordered_set<int>se;
bool amos=true;
deque<int>d;
int mini=INT_MAX;
for(int x=0;x<n;x++){
if(se.find(arr[x])!=se.end()) amos=false;
se.insert(arr[x]);
if(arr[x]<=n){
d.push_back(arr[x]);
mini=min(mini,arr[x]);
}
}
int ptr=1;
for(int x=1;x<=n;x++){
if(se.find(x)==se.end()){
if(se.find(ptr+n)==se.end()) amos=false;
ptr++;
}
}
if(!d.empty()){
while(d.front()!=mini){
d.push_front(d.back());
d.pop_back();
}
for(int x=1;x<(int)d.size();x++){
if(d[x]<d[x-1]) amos=false;
}
}
return amos;
}