이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
void cr2(int la, vector<int> &X, vector<int> &Y, vector<int> &cur){
vector<int> p1, p2;
for(int i = 0; i < cur.size(); ++i){
if(i&1)p2.push_back(cur[i]);
else p1.push_back(cur[i]);
}
if(p1.size() == 1){
X.push_back(p1[0]);
Y.push_back(0);
}
else{
X.push_back(-la-1);
Y.push_back(0);
cr2(la+1,X,Y,p1);
}
if(p2.size() == 1){
Y[la-1] = p2[0];
}
else{
Y[la-1] = -(X.size()+1);
cr2(X.size()+1,X,Y,p2);
}
return;
}
void create(int in, vector<int> &X, vector<int> &Y, vector<vector<int>> &v, vector<int> &c){
if(v[in].size() == 1){c[in] = v[in][0];return;}
if(!v[in].size())return;
c[in] = -(X.size()+1);
cr2(X.size()+1,X,Y,v[in]);
}
void create_circuit(int m, vector<int> A) {
int n = A.size();
vector<int> C(m + 1,0);
vector<vector<int>> v(m+1);
for(int i = 0; i < n; ++i){
if(!i)v[0].push_back(A[i]);
else v[A[i-1]].push_back(A[i]);
if(i == n-1)v[A[i]].push_back(0);
}
vector<int> X, Y;
for(int i = 0; i <= n; ++i){
create(i,X,Y,v,C);
}
answer(C,X,Y);
}
컴파일 시 표준 에러 (stderr) 메시지
doll.cpp: In function 'void cr2(int, std::vector<int>&, std::vector<int>&, std::vector<int>&)':
doll.cpp:8:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
8 | for(int i = 0; i < cur.size(); ++i){
| ~~^~~~~~~~~~~~
# | 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... |