제출 #787054

#제출 시각아이디문제언어결과실행 시간메모리
787054APROHACK자동 인형 (IOI18_doll)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "doll.h" #define ll long long #define pb push_back #define ff first #define ss second using namespace std; ll n, m, cur; vector<int>c, x, y; vector<int>a; ll generar(ll desde, ll cada, ll div, bool lastt){ if(div == 0){ return a[desde]; } if(a[desde] == -1 and ! lastt){ return a[desde]; }else if(m == 1 and a[desde] == 1 and a[((n-desde)/cada)*cada + desde] == 1 and ! last){ return 1; } ll posi = cur; ll real = -(cur + 1); x.pb(0); y.pb(0); cur ++ ; x[posi] = generar(desde, cada*2, div-1, false); y[posi] = generar(desde + cada, cada*2, div-1, lastt); return real; } void create_circuit(int M, std::vector<int> A) { cur = 0; a = A; n = A.size(); m = M; c.pb(A[0]); for(int i = 1 ; i <= M ; i ++)c.pb(-1); ll k = 1, pot = 0; while(k <= a.size()-1 ){ k *= 2; pot ++; } while(a.size()-1 < k)a.pb(-1); a.pop_back(); a.push_back(0); c[A[0]] = generar(1, 1, pot, true); answer(c, x, y); }

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

doll.cpp: In function 'long long int generar(long long int, long long int, long long int, bool)':
doll.cpp:19:84: error: 'last' was not declared in this scope; did you mean 'lastt'?
   19 |  }else if(m == 1 and a[desde] == 1 and a[((n-desde)/cada)*cada + desde] == 1 and ! last){
      |                                                                                    ^~~~
      |                                                                                    lastt
doll.cpp: In function 'void create_circuit(int, std::vector<int>)':
doll.cpp:41:10: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |  while(k <= a.size()-1 ){
      |        ~~^~~~~~~~~~~~~
doll.cpp:45:19: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'long long int' [-Wsign-compare]
   45 |  while(a.size()-1 < k)a.pb(-1);
      |        ~~~~~~~~~~~^~~