# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
363544 | silverfish | 곤돌라 (IOI14_gondola) | C++14 | 51 ms | 4844 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "gondola.h"
using namespace std;
#define ar array
#define pb push_back
int valid(int n, int a[]){
bool ok = 1, first = 1;
int diff = -1;
map<int, int> cnt;
for(int i = 0; i < n; ++i){
if(cnt[a[i]]) ok = 0;
++cnt[a[i]];
if(a[i] <= n){
if(first) {
diff = (a[i]-(i+1)+n)%n;
first = 0;
continue;
}
//cerr << i+1 << ' ' << (n+a[i]-diff)%n << endl;
if(i != (a[i]-diff-1+n)%n) ok = 0;
}
}
return ok;
}
//----------------------
int replacement(int n, int a[], int r[]){
bool ok = 1, first = 1;
int diff = -1;
vector<ar<int,2>> replaced;
for(int i = 0; i < n; ++i){
if(a[i] <= n){
diff = (a[i]-(i+1)+n)%n;
}else{
replaced.pb({a[i], i});
}
}
if(diff == -1) diff = 0;
sort(replaced.begin(), replaced.end());
int cur = 0, curnum = n+1;
for(auto x : replaced){
int val = x[0], pos = x[1];
int orig = (pos+1 + diff + n) % n;
r[cur++] = orig;
for(; curnum < x[0]; ++curnum) r[cur++] = curnum;
}
return cur;
}
//----------------------
int countReplacement(int n, int a[]){
if(!valid(n, a)) return 0;
return -1;
}
컴파일 시 표준 에러 (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... |