Submission #609751

#TimeUsernameProblemLanguageResultExecution timeMemory
609751sword060Unscrambling a Messy Bug (IOI16_messy)C++17
0 / 100
1 ms340 KiB
#include "messy.h"; #include <bits/stdc++.h> using namespace std; vector<int> restore_permutation(int x, int w, int r){ vector<int> ans(x); for(int i=0;i<x;i++)ans[i]=i+1; string p=""; for(int i=0;i<x;i++)p+='0'; for(int i=0;i<p.size()-1;i++){ p[i]='1';p[i+1]='1'; add_element(p); p[i]='0';p[i+1]='0'; } compile_set(); string lst="-1"; bool m=0; for(int i=1;i<=min(r,(1<<x));i++){ string l=""; int xd=i,zz=x; while(zz--)l+=(xd%2?'1':'0'),xd/=2; reverse(l.begin(),l.end()); bool f=check_element(l); if(!f)continue; for(int i=0;i<x;i++){ if(l[i]!='1'||i==x-1||l[i+1]!='1')continue; for(int j=i+2;j<x;j++){ if(l[j]=='1'){ swap(ans[j],ans[i+1]); } } } lst=l; } return ans; }

Compilation message (stderr)

messy.cpp:1:19: warning: extra tokens at end of #include directive
    1 | #include "messy.h";
      |                   ^
messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:9:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |   for(int i=0;i<p.size()-1;i++){
      |               ~^~~~~~~~~~~
messy.cpp:16:8: warning: unused variable 'm' [-Wunused-variable]
   16 |   bool m=0;
      |        ^
#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...