Submission #388878

#TimeUsernameProblemLanguageResultExecution timeMemory
388878jjang36524Unscrambling a Messy Bug (IOI16_messy)C++14
20 / 100
2 ms460 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.push_back(x[0]); 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++) { al.push_back(i); } pus(0,N,al); return an; }

Compilation message (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++)
      |             ~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...