# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
784803 | QwertyPi | 자동 인형 (IOI18_doll) | C++14 | 1081 ms | 20680 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
const int SLOT = 1234567;
using namespace std;
int S = 0;
map<int, int> MX, MY;
map<int, bool> T;
int build(int lv, int n){
if(n == 0) return 0;
if(lv == 0) return SLOT;
int sr = min(n, 1 << lv - 1), sl = n - sr;
int vl = build(lv - 1, sl);
int vr = build(lv - 1, sr);
int v = --S;
MX[v] = vl, MY[v] = vr;
return v;
}
void create_circuit(int M, vector<int> A) {
A.push_back(0);
int N = A.size();
std::vector<int> C(M + 1);
int level = 0; int x = N; while(x > (1 << level)) level++;
build(level, N);
int root = S;
C[0] = root;
for (int i = 1; i <= M; ++i) {
C[i] = root;
}
for(auto& [a, b] : MX) if(b == 0) b = root;
for(auto& [a, b] : MY) if(b == 0) b = root;
for(auto i : MX) T[i.first] = 0;
int cur = 0, filled = 0;
while(filled < N){
if(cur >= 0) cur = C[cur];
else {
if(T[cur] && MY[cur] == SLOT) MY[cur] = A[filled++];
if(!T[cur] && MX[cur] == SLOT) MX[cur] = A[filled++];
int nxt = T[cur] ? MY[cur] : MX[cur]; T[cur] ^= 1;
cur = nxt;
}
}
std::vector<int> X(MX.size()), Y(MY.size());
for (int k = 0; k < MX.size(); ++k) {
X[k] = MX[-k - 1], Y[k] = MY[-k - 1];
}
answer(C, X, Y);
}
컴파일 시 표준 에러 (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... |