제출 #601565

#제출 시각아이디문제언어결과실행 시간메모리
601565enerelt14자동 인형 (IOI18_doll)C++14
0 / 100
1 ms212 KiB
#include "doll.h" #include<bits/stdc++.h> #define pb push_back using namespace std; vector<int>a; int c[100005], x[400005], y[400005]; bool is[400005]; int m, k, la, q; int tree[400005]; void go(int id, int l, int r){ if(l==r){ if (q==(1<<la))tree[id]=-(k+q); else tree[id]=a[q+k-1]; return; } else tree[id]=-(k+id); int mid=(l+r)/2; if (!is[id]){ go(id*2, l, mid); x[id+k]=tree[id*2]; is[id]=1; } else{ go(id*2+1, mid+1, r); y[id+k]=tree[id*2+1]; is[id]=0; } } void solve(){ la=0; while((1<<(la+1))<=m+1)la++; for (int i=1;i<(1<<la);i++){ c[a[i+k-1]]=-(k+1); q=i; go(1, 1, (1<<la)); } q++; go(1, 1, (1<<la)); m-=((1<<la)-1); k+=((1<<la)-1); if (m==0){ x[k+1]=-(k+1); y[k+1]=0; } } void create_circuit(int M, vector<int>A){ for (int i=1;i<=M;i++)c[i]=0; a=A; m=A.size(); while(m!=0){ solve(); } vector<int>X, Y, C; C.pb(-1); for (int i=1;i<=M;i++){ C.pb(c[i]); cout<<c[i]<<" "; } cout<<"\n"; for (int i=1;i<=A.size()+1;i++){ X.pb(x[i]); cout<<x[i]<<" "; } cout<<"\n"; for (int i=1;i<=A.size()+1;i++){ Y.pb(y[i]); cout<<y[i]<<" "; } cout<<"\n"; answer(C, X, Y); }

컴파일 시 표준 에러 (stderr) 메시지

doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:60:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |     for (int i=1;i<=A.size()+1;i++){
      |                  ~^~~~~~~~~~~~
doll.cpp:65:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   65 |     for (int i=1;i<=A.size()+1;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...