이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include<bits/stdc++.h>
using namespace std;
int rev(int node, int nb){
cout << node << ' ';
int ans = 0;
for (int i=0; i<nb; ++i){
if (node&(1<<i)){
ans += (1<<(nb-1-i));
}
}
cout << ans << endl;
return ans;
}
void create_circuit(int M, vector<int> bisA) {
deque<int> A;
for (int i:bisA) A.emplace_back(i);
int pow2 = 1, N = A.size();
vector<int> C(M+1,-1);
if(N == 1){
C = vector<int>(M+1);
vector<int> da,db;
C[0] = A[0];
C[A[0]] = 0;
answer(C,da,db);
return;
}
int nb = 0;
while (pow2 < N+1){
nb++;
pow2 *= 2;
}
A.emplace_back(0);
while (A.size() < pow2) A.emplace_front(-1);
pow2 /= 2;
vector<int> X(2*pow2-1,-1),Y(2*pow2-1,-1);
for (int i=0; i<pow2-1; ++i){
X[i] = -(2*(i+1));
Y[i] = -(2*(i+1)+1);
}
/* cout << "A : ";
for (int i:A) cout << i << ' ';
cout << endl;
*/ for(int idx=pow2-1, id = 0; idx<X.size(); ++idx, ++id){
X[idx] = A[rev(2*id,nb)];
Y[idx] = A[rev(2*id+1,nb)];
}
/* for (int i=0; i<X.size(); ++i){
cout << -i-1 << " : " << X[i] << ' ' << Y[i] << endl;
}
*/ answer(C,X,Y);
}
컴파일 시 표준 에러 (stderr) 메시지
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:36:18: warning: comparison of integer expressions of different signedness: 'std::deque<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
36 | while (A.size() < pow2) A.emplace_front(-1);
| ~~~~~~~~~^~~~~~
doll.cpp:46:35: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
46 | */ for(int idx=pow2-1, id = 0; idx<X.size(); ++idx, ++id){
| ~~~^~~~~~~~~
# | 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... |