Submission #259799

#TimeUsernameProblemLanguageResultExecution timeMemory
259799uacoder123Unscrambling a Messy Bug (IOI16_messy)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; #define F first #define S second #define FOR(i,a,b) for (auto i = (a); i <= (b); ++i) #define NFOR(i,a,b) for(auto i = (a); i >= (b); --i) #define all(x) (x).begin(), (x).end() #define sz(x) int(x.size()) #define mp(i,a) make_pair(i,a) #define pb(a) push_back(a) #define bit(x,b) (x&(1LL<<b)) typedef int lli; typedef pair <lli,lli> ii; typedef pair <lli,ii> iii; typedef vector <lli> vi; vi v; void init(int l,int r,int n) { if(l==r) return; int m=(l+r)/2; string s; for(int i=0;i<n;++i) { if(i<l||i>r) s+="1"; else s+="0"; } for(int i=l;i<=m;++i) { s[i]='1'; add_element(s); s[i]='0'; } init(l,m,n); init(m+1,r,n); } void solve(int l,int r,string s) { if(l==r) { for(int i=0;i<n;++i) { if(s[i]=='0') { v[i]=l; break; } } return; } string s1=s,s2=s; for(int i=0;i<n;++i) { if(s[i]!='1') { s[i]='1'; if(check_element(s)) s2[i]='1'; else s1[i]='1'; s[i]='0'; } } int m=(l+r)/2; solve(l,m,s1); solve(m+1,r,s2); } std::vector<int> restore_permutation(int n, int w, int r) { init(0,n-1,n); compile_set(); string s; for(int i=0;i<n;++i) { v.pb(0); s+="0"; } solve(0,n-1,s); return v; }

Compilation message (stderr)

messy.cpp: In function 'void solve(int, int, std::__cxx11::string)':
messy.cpp:45:23: error: 'n' was not declared in this scope
         for(int i=0;i<n;++i)
                       ^
messy.cpp:56:19: error: 'n' was not declared in this scope
     for(int i=0;i<n;++i)
                   ^