이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "doll.h"
#define int long long
#define all(a) a.begin(), a.end()
#define rep(i,n) for(int i = 0; i<n; i++)
using namespace std;
vector<signed>x,y;
int pow2=1;
int cs = 0, ct = 1;
map<int,pair<int,int>>ind;
int build(int l, int r, vector<signed>&a)
{
if(r<=pow2-a.size()) return -1;
if(l+1==r) return ct++;
cs++;
int ccs = -cs;
ind[ccs].first = build(l,(l+r)/2,a);
ind[ccs].second = build((l+r)/2,r,a);
return ccs;
}
int cntr = 0;
map<int,bool>flip;
int sim(int cs, vector<signed>&a)
{
if(cs>0) return a[cntr++];
flip[cs]=!flip[cs];
if(flip[cs]) x[-cs-1]=sim(ind[cs].first,a);
else y[-cs-1]=sim(ind[cs].second,a);
return cs;
}
void create_circuit(signed m, vector<signed> a) {
signed n = a.size();
vector<signed>c(m+1);
c[0]=a[0];
if(n==1)
{
c[a[0]]=0;
return answer(c,{},{});
}
a.push_back(0);
a.erase(a.begin(), a.begin()+1);
while (pow2<a.size()) pow2*=2;
rep(i,m) c[i+1]=-1;
build(0,pow2,a);
x.assign(cs,1e9);
y.assign(cs,1e9);
rep(i,n) sim(-1,a);
answer(c,x,y);
}
컴파일 시 표준 에러 (stderr) 메시지
doll.cpp: In function 'long long int build(long long int, long long int, std::vector<int>&)':
doll.cpp:16:7: warning: comparison of integer expressions of different signedness: 'long long int' and 'long long unsigned int' [-Wsign-compare]
16 | if(r<=pow2-a.size()) return -1;
| ~^~~~~~~~~~~~~~~
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:50:14: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
50 | while (pow2<a.size()) pow2*=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... |