이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
typedef pair<int, int> pii;
#define SZ(x) int((x).size())
#define X first
#define Y second
#define sep ' '
int curInd = 1;
vector<pii> res;
int solve(vector<int> vec){
int flag = 1;
for(int i = 0 ; i < SZ(vec) ; i++){
if(vec[i] != vec[0]){
flag = 0;
}
}
if(flag){
return vec[0];
}
int root = curInd++ , n = 1 , ptr = 0 , ind = SZ(res);
res.push_back({-1 , -1});
while(n < SZ(vec)) n *= 2;
vector<int> left , right;
for(int i = 0 ; i < SZ(vec) - n / 2 ; i++){
left.push_back(vec[ptr++]);
right.push_back(vec[ptr++]);
}
while(ptr < SZ(vec)){
right.push_back(vec[ptr++]);
}
while(SZ(left) < SZ(right)){
left.push_back(-1);
}
int lc = solve(left);
int rc = solve(right);
res[ind] = {lc , rc};
return -root;
}
void create_circuit(int M, vector<int> A) {
A.push_back(0);
int root = solve(A);
vector<int> C , x , y;
for(int i = 0 ; i <= M ; i++){
C.push_back(-1);
//cout << i << sep << -1 << endl;
}
for(int i = 0 ; i < SZ(res) ; i++){
x.push_back(res[i].X);
y.push_back(res[i].Y);
//cout << -(i + 1) << sep << res[i].X << sep << res[i].Y << endl;
}
answer(C , x , y);
}
컴파일 시 표준 에러 (stderr) 메시지
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:47:9: warning: unused variable 'root' [-Wunused-variable]
47 | int root = solve(A);
| ^~~~
# | 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... |