Submission #885256

#TimeUsernameProblemLanguageResultExecution timeMemory
885256hugsfromadictoUnscrambling a Messy Bug (IOI16_messy)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; int N; const int MAX=130; void write(int l, int r, int N) { if(l==r) return; string s=""; for(int i=0;i<N;++i) { if(l<=r and i<=r) { s+='0'; } else { s+='1'; } } int mid=(l+r)>>1; for(int i=l;i<=mid;++i) { s[i]='1'; add_element(s); s[i]='0'; } write(l,mid,N); write(mid+1,r,N); } int p[MAX]; void read(int l, int r, vector<int> v;int N) { if(l==r) { p[v[0]]=l; return; } string s=""; for(int i=0;i<n;++i) { s+='1'; } for(int a:v) { s[a]='0'; } int mid=(l+r)>>1; vector<int>left,right; for(int i:v) { s[i]='1'; if(check_element(s)) { left.push_back(i); } else{ right.push_back(i); } s[i]='0'; } read(l, mid, left, N); read(mid + 1, r, right, N); } vector<int> restore_permutation(int N,int w,int r) { write(0,n-1,n); compile_set(); vector<int>tmp; for(int i=0;i<N;++i) { tmp.push_back(i); } read(0,n-1,tmp,N); vector<int>res; for(int i = 0; i < N; i++){ res.push_back(p[i]); } return res; }

Compilation message (stderr)

messy.cpp:34:38: error: expected ')' before ';' token
   34 | void read(int l, int r, vector<int> v;int N)
      |          ~                           ^
      |                                      )
messy.cpp:34:44: error: expected initializer before ')' token
   34 | void read(int l, int r, vector<int> v;int N)
      |                                            ^
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:72:13: error: 'n' was not declared in this scope
   72 |     write(0,n-1,n);
      |             ^