제출 #586156

#제출 시각아이디문제언어결과실행 시간메모리
586156tamthegodUnscrambling a Messy Bug (IOI16_messy)C++14
컴파일 에러
0 ms0 KiB
#include<bits/stdc++.h> #define pb push_back #define fi first #define se second using namespace std; using ll = long long; using ld = long double; using ull = unsigned long long; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); const int maxN = 1e3 + 5; const int mod = 1e9 + 7; const ll oo = 1e18; vector<int> p; vector<int> vc[maxN][maxN]; string s; void Prepair(int l, int r) { if(l == r) return; int mid = (l + r) / 2; for(int i=l; i<=mid; i++) { s[i] = '1'; add_element(s); s[i] = '0'; } for(int i=mid+1; i<=r; i++) s[i] = '1'; Prepair(l, mid); for(int i=mid+1; i<=r; i++) s[i] = '0'; for(int i=mid+1; i<=r; i++) { s[i] = '1'; add_element(s); s[i] = '0'; } for(int i=l; i<=mid; i++) s[i] = '1'; Prepair(mid + 1, r); for(int i=l; i<=mid; i++) s[i] = '0'; } void DnC(int l, int r) { if(l == r) return; int mid = (l + r) / 2; for(int i=l; i<=mid; i++) { s[i] = '1'; if(check_element(s)) vc[l][mid].pb(i); else vc[mid + 1][r].pb(i); s[i] = '0'; } for(int i : vc[mid + 1][r]) s[i] = '1'; DnC(l, mid); for(int i : vc[mid + 1][r]) s[i] = '0'; for(int i : vc[l][mid]) s[i] = '1'; DnC(mid + 1, r); for(int i : vc[l][mid]) s[i] = '0'; } vector<int> restore_permutation(int n, int w, int r) { p.resize(n); for(int i=0; i<n; i++) vc[0][n - 1].pb(i); for(int i=0; i<n; i++) s += '0'; Prepair(0, n - 1); compile_set(); for(int i=0; i<n; i++) s[i] = '0'; DnC(0, n - 1); for(int i=0; i<n; i++) p[i] = vc[i][i]; return p; } /*void Solve() { } int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); ReadInput(); Solve(); }*/

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

messy.cpp: In function 'void Prepair(int, int)':
messy.cpp:25:9: error: 'add_element' was not declared in this scope
   25 |         add_element(s);
      |         ^~~~~~~~~~~
messy.cpp:34:9: error: 'add_element' was not declared in this scope
   34 |         add_element(s);
      |         ^~~~~~~~~~~
messy.cpp: In function 'void DnC(int, int)':
messy.cpp:48:12: error: 'check_element' was not declared in this scope
   48 |         if(check_element(s)) vc[l][mid].pb(i);
      |            ^~~~~~~~~~~~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:66:5: error: 'compile_set' was not declared in this scope
   66 |     compile_set();
      |     ^~~~~~~~~~~
messy.cpp:69:42: error: cannot convert 'std::vector<int>' to '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} in assignment
   69 |     for(int i=0; i<n; i++) p[i] = vc[i][i];
      |                                   ~~~~~~~^
      |                                          |
      |                                          std::vector<int>