제출 #1073796

#제출 시각아이디문제언어결과실행 시간메모리
10737964QT0RUnscrambling a Messy Bug (IOI16_messy)C++17
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; vector<int> odp; void build(int l, int p, int n){ if (l==p)return; string s; for (int i = 0; i<n; i++)s+='1'; for (int i = l; i<=p; i++){ s[i]='0'; } int md=(l+p)/2; for (int i = l; i<=md; i++){ s[i]='1'; add_element(s); s[i]='0'; } build(l,md,n); build(md+1,p,n); } void reconstruct(int l, int p, int n, vector<int> podz){ if (l==p){ odp[podz[0]]=l; return; } string s; for (int i = 0; i<n; i++)s+='1'; for (auto u : podz)s[u]='0'; vector<int> lewo,prawo; for (auto u : podz){ s[u]='1'; if (check_element(s))lewo.push_back(u); else prawo.push_back(u); s[u]='0'; } reconstruct(l,(l+p)/2,n,lewo); reconstruct((l+p)/2+1,p,n,prawo); } vector<int> restore_permutation(int n, int w, int r){ odp.resize(n); build(0,n-1,n); compile_set(); vector<int> wszystko; for (int i = 0; i<n; i++)wszystko.push_back(i); reconstruct(0,n-1,n,wszystko); odpowiedz(odp); }

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

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:50:2: error: 'odpowiedz' was not declared in this scope
   50 |  odpowiedz(odp);
      |  ^~~~~~~~~
messy.cpp:51:1: warning: no return statement in function returning non-void [-Wreturn-type]
   51 | }
      | ^