제출 #147613

#제출 시각아이디문제언어결과실행 시간메모리
147613Bodo171자동 인형 (IOI18_doll)C++14
37 / 100
136 ms13764 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...