제출 #586149

#제출 시각아이디문제언어결과실행 시간메모리
586149Tien_NoobUnscrambling a Messy Bug (IOI16_messy)C++17
컴파일 에러
0 ms0 KiB
//Make CSP great again //Vengeance #include <bits/stdc++.h> //#include <messy.h> #define TASK "TESTCODE" #define Log2(x) 31 - __builtin_clz(x) using namespace std; string s; vector<int> res; void gen(int l, int r) { if (l == r) { return ; } int mid = (l + r)/2; for (int i = mid + 1; i <= r; ++ i) { s[i] = '0'; } for (int i = l; i <= mid; ++ i) { s[i] = '0'; } for (int i = l; i <= mid; ++ i) { s[i] = '1'; //cerr << s << '\n'; add_element(s); s[i] = '0'; } for (int i = mid + 1; i <= r; ++ i) { s[i] = '1'; } gen(l, mid); for (int i = l; i <= mid; ++ i) { s[i] = '0'; } for (int i = mid + 1; i <= r; ++ i) { s[i] = '0'; } for (int i = mid + 1; i <= r; ++ i) { s[i] = '1'; //cerr << s << '\n'; add_element(s); s[i] = '0'; } for (int i = l; i <= mid; ++ i) { s[i] = '1'; } gen(mid + 1, r); } void DnC(int l, int r, vector<int> val) { if (l == r) { assert(!val.empty()); res[l] = val.front(); return ; } vector<int> L, R; int mid = (l + r)/2; for (int i : val) { s[i] = '0'; } for (int i : val) { s[i] = '1'; if (check_element(s)) { L.push_back(i); } else { R.push_back(i); } s[i] = '0'; } for (int i : L) { s[i] = '0'; } for (int i : R) { s[i] = '1'; } DnC(l, mid, L); for (int i : R) { s[i] = '0'; } for (int i : L) { s[i] = '1'; } DnC(mid + 1, r, R); } vector<int> restore_permutation(int n, int w, int r) { s.resize(n, '0'); res.resize(n); gen(0, n - 1); compile_set(); vector<int> tmp(n); iota(tmp.begin(), tmp.end(), 0); DnC(0, n - 1, tmp); return res; } /*void read() { restore_permutation(8, 10, 10); } void solve() { } int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); if (fopen(TASK".INP", "r")) { freopen(TASK".INP", "r", stdin); //freopen(TASK".OUT", "w", stdout); } int t = 1; bool typetest = false; if (typetest) { cin >> t; } for (int __ = 1; __ <= t; ++ __) { //cout << "Case " << __ << ": "; read(); solve(); } }*/

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

messy.cpp: In function 'void gen(int, int)':
messy.cpp:29:9: error: 'add_element' was not declared in this scope
   29 |         add_element(s);
      |         ^~~~~~~~~~~
messy.cpp:52:9: error: 'add_element' was not declared in this scope
   52 |         add_element(s);
      |         ^~~~~~~~~~~
messy.cpp: In function 'void DnC(int, int, std::vector<int>)':
messy.cpp:78:13: error: 'check_element' was not declared in this scope
   78 |         if (check_element(s))
      |             ^~~~~~~~~~~~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:112:5: error: 'compile_set' was not declared in this scope
  112 |     compile_set();
      |     ^~~~~~~~~~~