제출 #388893

#제출 시각아이디문제언어결과실행 시간메모리
388893jjang36524Unscrambling a Messy Bug (IOI16_messy)C++14
컴파일 에러
0 ms0 KiB
#include <vector> #include "messy.h" using namespace std; int N; void pus(int s,int e) { if(s+1==e) return; string st; int i; for(i=0;i<N;i++) { st.push_back('0'); } for(i=s;i<e;i++) { st[i]='1'; } for(i=s;i<(e+s)/2;i++) { st[i]='0'; add_element(st); st[i]='1'; } pus(s,(s+e)/2); pus((s+e)/2,e); } vector<int>an; void pus(int s,int e,vector<int>x) { if(s+1==e) { an[x[0]]=s; return; } string st; int i; for(i=0;i<N;i++) { st.push_back('0'); } for(i=0;i<x.size();i++) { st[x[i]]='1'; } vector<int>l; vector<int>r; for(i=0;i<x.size();i++) { st[x[i]]='0'; int a=check_element(st); if(a) l.push_back(x[i]); else r.push_back(x[i]); st[x[i]]='1'; } pus(s,(s+e)/2,l); pus((s+e)/2,e,r); } std::vector<int> restore_permutation(int n, int w, int r) { N=n; pus(0,N); compile_set(); vector<int>al; int i; for(i=0;i<n;i++) { an.push_back(0);8 al.push_back(i); } pus(0,N,al); return an; }

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

messy.cpp: In function 'void pus(int, int, std::vector<int>)':
messy.cpp:43:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |     for(i=0;i<x.size();i++)
      |             ~^~~~~~~~~
messy.cpp:49:14: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   49 |     for(i=0;i<x.size();i++)
      |             ~^~~~~~~~~
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:71:26: error: expected ';' before 'al'
   71 |         an.push_back(0);8
      |                          ^
      |                          ;
   72 |         al.push_back(i);
      |         ~~                
messy.cpp:71:25: warning: statement has no effect [-Wunused-value]
   71 |         an.push_back(0);8
      |                         ^