Submission #343168

#TimeUsernameProblemLanguageResultExecution timeMemory
343168Sho10Unscrambling a Messy Bug (IOI16_messy)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10 #define ll long long #define double long double #pragma GCC optimize("O3") #pragma GCC optimize("Ofast") #define all(a) (a).begin(), (a).end() #define f first #define s second #define pb push_back #define mp make_pair #define pi pair #define rc(s) return cout<<s,0 #define endl '\n' #define mod 1000000007 #define PI 3.14159265359 #define MAXN 100005 #define INF 1000000005 #define LINF 1000000000000000005ll #define CODE_START ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); using namespace std; ll n,a[128]; void build(ll l,ll r){ if(l==r){ return; } string s=""; for(ll i=0;i<n;i++) { s.pb('0'); } for(ll i=l;i<=r;i++) { s[i]='1'; } ll mid=(l+r)/2; for(ll i=mid+1;i<=r;i++) { s[i]='0'; add_element(s); s[i]='1'; } solve(l,mid); solve(mid+1,r); } void calc(ll l,ll r,vector<ll>vec){ if(l==r){ a[vec[0]]=l; return; } ll mid=(l+r)/2; string s=""; for(ll i=0;i<n;i++) { s.pb('0'); } for(auto &it : vec){ vec[it]='1'; } vector<ll>x,y; for(auto &i : vec){ s[i]='0'; if(check_element(s)){ y.pb(i); }else x.pb(i); s[i]='1'; } calc(l,mid,x); calc(mid+1,r,y); } vector<int>restore_permutation(int m,int w,int r){ n=m; build(0,n-1); compile_set(); vector<int>v; for(ll i=0;i<n;i++) { v.pb(i); } calc(0,n-1,v); vector<int>ans; for(ll i=0;i<n;i++) { ans.pb(a[i]); } return ans; } /* int32_t main(){ CODE_START; */

Compilation message (stderr)

messy.cpp: In function 'void build(long long int, long long int)':
messy.cpp:39:1: error: 'add_element' was not declared in this scope
   39 | add_element(s);
      | ^~~~~~~~~~~
messy.cpp:42:1: error: 'solve' was not declared in this scope
   42 | solve(l,mid);
      | ^~~~~
messy.cpp: In function 'void calc(long long int, long long int, std::vector<long long int>)':
messy.cpp:62:4: error: 'check_element' was not declared in this scope
   62 | if(check_element(s)){
      |    ^~~~~~~~~~~~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:73:1: error: 'compile_set' was not declared in this scope
   73 | compile_set();
      | ^~~~~~~~~~~
messy.cpp:79:12: error: could not convert 'v' from 'vector<int>' to 'vector<long long int>'
   79 | calc(0,n-1,v);
      |            ^
      |            |
      |            vector<int>