Submission #308953

#TimeUsernameProblemLanguageResultExecution timeMemory
308953amunduzbaevUnscrambling a Messy Bug (IOI16_messy)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; #include "messy.h" //#include "grader.cpp" vector<string>v; int n1; void add(){ string s(n1,'0'); s[0]='0'; for(int i=1;i<n1;i++) s[i]='1'; int last=1; for(int i=0;i<n1-1;i++){ add_element(s); s[last]='0'; last++; } //cout<<"worked\n"; } void check(){ string s(n1,'0'); for(int i=0;i<n-1;i++){ for(int j=0;j<n;j++){ if(s[j]=='0'){ s[j]='1'; if(check_element(s)) { v.push_back(s); break; } else s[j]='0'; } } } } vector<int> restore_permutation(int N, int w, int r) { n1=N; add(); compile_set(); check(); int vs=v.size(); vector<int>ans(n1,0),a(n1,0); for(int i=0;i<vs;i++){ for(int j=0;j<n1;j++){ a[j]+=(v[i][j]-'0'); } } //for(int i=0;i<n1;i++){ // ans[a[i]]=i; //} //for(int i=0;i<n1;i++) // cout<<a[i]<<" "; return a; } /* 4 16 16 1 3 2 0 */

Compilation message (stderr)

messy.cpp: In function 'void check()':
messy.cpp:24:19: error: 'n' was not declared in this scope
   24 |     for(int i=0;i<n-1;i++){
      |                   ^