제출 #416533

#제출 시각아이디문제언어결과실행 시간메모리
416533sofapuden자동 인형 (IOI18_doll)C++14
0 / 100
1 ms332 KiB
#include "doll.h" #include<bits/stdc++.h> using namespace std; vector<int> X, Y, A, FLG; int h, v, n; const int UNDEF = 7e6+5; int cn = 0; int cnt = 0; void fin(int x, int p, int am, int val, bool ok){ if(!am){ cnt--; if(ok){ Y[p] = -1; } else X[p] = -1; fin(0,0,n,v,0); return; } if(!val){ cnt--; if(ok){ Y[p] = A[cn++]; } else X[p] = A[cn++]; fin(0,0,n,v,0); return; } if(X.size() < x){ X.push_back(UNDEF); Y.push_back(UNDEF); FLG.push_back(0); X.back() = ++cnt; fin(cnt,x,max(0,am-val),val>>1,0); return; } FLG[x]^=1; if(FLG[x]){ if(Y[x] == UNDEF){ Y.back() = ++cnt; fin(cnt,x,min(am,val),val>>1,1); } else{ fin(-Y[x]-1,x,min(am,val),val>>1,1); } return; } else{ fin(-X[x]-1,x,max(0,am-val),val>>1,0); } } void create_circuit(int m, vector<int> _A) { _A.push_back(0); n = A.size(); A = _A; vector<int> C(m+1,-1); h = ceil(log2(n)); v = (1<<(h-1)); fin(0,0,n,v,0); answer(C, X, Y); }

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

doll.cpp: In function 'void fin(int, int, int, int, bool)':
doll.cpp:33:14: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |  if(X.size() < x){
      |     ~~~~~~~~~^~~
#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...