# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
72911 | nvmdava | Gondola (IOI14_gondola) | C++17 | 76 ms | 5116 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "gondola.h"
#include <bits/stdc++.h>
using namespace std;
struct Gondola{
int id, val;
Gondola(int _id, int _val){
id = _id;
val = _val;
}
bool operator<(const Gondola& rhs) const{
val < rhs.val;
}
};
int ord[100001];
map<int, int> in;
vector<Gondola> v;
int valid(int n, int inputSeq[]){
int i;
for(i = 0; i < n; i++){
if(in[inputSeq[i]]) return 0;
in[inputSeq[i]] = 1;
}
for(i = 0; i < n; i++){
if(inputSeq[i] <= n) break;
}
if(i == n) return 1;
int k = inputSeq[i] - 1;
for(int j = 0; j < n; j++){
ord[(k + j) % n] = inputSeq[(i + j) % n];
if((ord[(k + j) % n] != (k + j) % n + 1 && ord[(k + j) % n] <= n) || ord[(k + j) % n] < 1) return 0;
}
for(i = 0; i < n; i++){
if((ord[i] != i + 1 && ord[i] <= n) || ord[i] < 1) return 0;
}
return 1;
}
//----------------------
int replacement(int n, int gondolaSeq[], int replacementSeq[]){
int i;
for(i = 0; i < n; i++){
if(gondolaSeq[i] <= n) break;
}
int k;
if(i == n){
i = 0;
k = 0;
} else {
k = gondolaSeq[i] - 1;
}
for(int j = 0; j < n; j++){
v.push_back(Gondola((k + j) % n + 1, gondolaSeq[(i + j) % n]));
}
sort(v.begin(), v.end());
i = 0;
int s = n + 1;
for(auto x : v){
if(x.val <= n) continue;
replacementSeq[i] = x.id;
i++;
for(; s < x.val; s++){
replacementSeq[i] = s;
i++;
}
s = x.val + 1;
}
return i;
}
//----------------------
int countReplacement(int n, int inputSeq[]){
int i;
for(i = 0; i < n; i++){
if(inputSeq[i] <= n) break;
}
int k;
if(i == n){
i = 0;
k = 0;
} else {
k = inputSeq[i] - 1;
}
for(int j = 0; j < n; j++){
ord[(k + j) % n] = inputSeq[(i + j) % n];
}
}
컴파일 시 표준 에러 (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... |