이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "doll.h"
#include <bits/stdc++.h>
using namespace std;
const int nmax=800005;
vector<int> C,X,Y,a,act;
int et[nmax],lf[nmax],rg[nmax],w[nmax],rly[nmax];
int p,u,ets,i,lg;
void build(int nod,int l,int r)
{
if(l==r)
{
rly[nod]=act[l];
return;
}
int m=(l+r)/2;
build(2*nod,l,m);
build(2*nod+1,m+1,r);
w[nod]=w[2*nod]+w[2*nod+1];
}
int rev(int x,int lg)
{
int ret=0;
for(int b=0;b<lg;b++)
{
if((x&(1<<b)))
ret|=(1<<(lg-b-1));
}
return ret;
}
void create_circuit(int M, std::vector<int> A) {
int n = A.size();
C.resize(M+1);
for(i=0;i<=M;i++)
C[i]=-1;
while((1<<lg)<n+1)
lg++;
act.resize((1<<lg),(1<<30));
for(i=0;i<A.size();i++)
act[rev(i,lg)]=A[i];
act[(1<<lg)-1]=0;
build(1,0,(1<<lg)-1);
int reale=0;
for(int nod=(1<<lg)-1;nod>=1;nod--)
{
if(rly[2*nod]==rly[2*nod+1])
{
rly[nod]=rly[2*nod];
}
else
{
reale++;
rly[nod]=-reale;
X.push_back(rly[2*nod]);
Y.push_back(rly[2*nod+1]);
}
}
for(i=0;i<X.size();i++)
{
if(X[i]==(1<<30)) X[i]=rly[1];
if(Y[i]==(1<<30)) Y[i]=rly[1];
}
for(i=0;i<=M;i++)
C[i]=rly[1];
answer(C, X, Y);
}
컴파일 시 표준 에러 (stderr) 메시지
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:38:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
38 | for(i=0;i<A.size();i++)
| ~^~~~~~~~~
doll.cpp:57:12: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
57 | for(i=0;i<X.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... |