# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
586203 | LastRonin | 곤돌라 (IOI14_gondola) | C++14 | 29 ms | 4604 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
#define ll long long
#define mp make_pair
#define f first
#define s second
#define pb push_back
using namespace std;
int valid(int n, int inputSeq[]) {
int pos = -1;
set<ll> b;
for(int i = 0; i < n; i++)
b.insert(inputSeq[i]);
if(b.size() != n)return 0;
for(int i = 0; i < n; i++) {
if(inputSeq[i] <= n) {
pos = i;
break;
}
}
if(pos == -1)return 1;
ll a = inputSeq[pos];
ll nxt = pos;
for(int j = 0; j <= n; j++) {
if(inputSeq[nxt] <= n && inputSeq[nxt] != a)return 0;
a++;
if(a == n + 1)a = 1;
nxt = (nxt + 1) % n;
}
return 1;
}
int replacement(int n, int gondolaSeq[], int replacementSeq[]) {
vector<pair<int, int>> z;
int pos = -1;
int a[n] = {0};
for(int i = 0; i < n; i++) {
if(gondolaSeq[i] <= n) {
pos = i;
}
z.pb(mp(gondolaSeq[i], i));
}
int b = (pos == -1 ? 1 : gondolaSeq[pos]);
pos = (pos == -1 ? 0 : pos);
for(int j = 0 ; j < n; j++) {
a[pos] = b;
pos = (pos + 1) % n;
b++;
if(b == n + 1)b = 1;
}
int cur = 0;
ll mx = n + 1;
for(auto u : z) {
if(u.f <= n)continue;
replacementSeq[cur++] = a[u.s];
while(mx != u.f) {
replacementSeq[cur++] = mx;
mx++;
}
}
sort(z.begin(), z.end());
return cur;
}
int countReplacement(int n, int inputSeq[]){
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |