제출 #885260

#제출 시각아이디문제언어결과실행 시간메모리
885260hugsfromadictoUnscrambling a Messy Bug (IOI16_messy)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "messy.h" using namespace std; 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; }

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

messy.cpp: In function 'void read(int, int, std::vector<int>, int)':
messy.cpp:41:19: error: 'n' was not declared in this scope
   41 |     for(int i=0;i<n;++i)
      |                   ^