제출 #1043705

#제출 시각아이디문제언어결과실행 시간메모리
1043705dpsaveslivesUnscrambling a Messy Bug (IOI16_messy)C++17
컴파일 에러
0 ms0 KiB
#include "messy.h" #include <bits/stdc++.h> using namespace std; int n; vector<int> ans; void solve(int l, int r){ //we can do recursion! if(l == r) return; int mid = (l+r)>>1; string s; for(int i = 0;i<n;++i){ s += '0'; } for(int i = l;i<=r;++i){ s[i] = '1'; } for(int i = mid+1;i<=r;++i){ s[i] = '0'; add_element(s); cout << s << "\n"; s[i] = '1'; } solve(l,mid); solve(mid+1,r); } void read(int l, int r, vector<int> v){ if(l == r){ ans[v[0]] = l; return; } int mid = (l+r)>>1; string s; for(int i = 0;i<n;++i){ s += '0'; } for(auto x : v){ s[x] = '1'; } vector<int> low, high; for(auto x : v){ s[x] = '0'; if(check_element(s)){ high.push_back(x); } else{ low.push_back(x); } s[x] = '1'; } read(l,mid,low); read(mid+1,r,high); } vector<int> restore_permutation(int N, int w, int r){ n = N; ans = vector<int>(N); solve(0,N-1); vector<int> v; for(int i = 0;i<N;++i){ v.push_back(i); } solve2(0,N-1,v); return ans; }

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:57:5: error: 'solve2' was not declared in this scope; did you mean 'solve'?
   57 |     solve2(0,N-1,v);
      |     ^~~~~~
      |     solve