이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
pair<int, int> exits[400005];
vector<int> C, X, Y;
vector<int> afterInList[400005];
int nextSwitchIdx = -1;
int build(int i, vector<int> cur) {
if(cur.size() == 1) {
return cur[0];
}
if(i >= 0) {
return build(nextSwitchIdx--, cur);
}
if(X.size() < abs(i)) {
X.resize(abs(i));
Y.resize(abs(i));
}
vector<int> nextCur;
for(int j = 0; j < cur.size(); j+=2)
nextCur.push_back(cur[j]);
X[-(i+1)] = build(nextSwitchIdx--, nextCur);
nextCur.clear();
for(int j = 1; j < cur.size(); j+=2)
nextCur.push_back(cur[j]);
Y[-(i+1)] = build(nextSwitchIdx--, nextCur);
return i;
}
void create_circuit(int M, vector<int> A) {
int N = A.size();
C.assign(M+1, 0);
afterInList[0].push_back(A[0]);
for(int i = 0; i+1 < N; i++)
afterInList[A[i]].push_back(A[i+1]);
afterInList[A.back()].push_back(0);
for(int i = 0; i <= M; i++) {
if(afterInList[i].empty())
continue;
C[i] = build(i, afterInList[i]);
}
answer(C, X, Y);
}
컴파일 시 표준 에러 (stderr) 메시지
doll.cpp: In function 'int build(int, std::vector<int>)':
doll.cpp:26:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
26 | for(int j = 0; j < cur.size(); j+=2)
| ~~^~~~~~~~~~~~
doll.cpp:31:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
31 | for(int j = 1; j < cur.size(); j+=2)
| ~~^~~~~~~~~~~~
# | 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... |