Submission #59792

#TimeUsernameProblemLanguageResultExecution timeMemory
59792alenam0161Unscrambling a Messy Bug (IOI16_messy)C++17
20 / 100
3 ms384 KiB
#include <vector> #include "messy.h" #include <bits/stdc++.h> using namespace std; const int N = 1007; int wh[N]; bool used[N]; std::vector<int> restore_permutation(int n, int w, int r) { srand(1572921); string s=string(n,'0'); for(int i=1;i<n;++i){ string s1=string(i,'1'); s1+=string(n-i,'0'); add_element(s1); } compile_set(); for(int i=0;i<n-1;++i){ string sx=s; vector<int> l; for(int j=0;j<n;++j){ if(used[j]==0){ l.push_back(j); } } random_shuffle(l.begin(),l.end()); for(int j=0;j<l.size();++j){ string nw=s; nw[l[j]]='1'; if(check_element(nw)){ s[l[j]]='1'; wh[i]=l[j]; used[l[j]]=true; break; } } } for(int j=0;j<n;++j){ if(used[j]==0)wh[n-1]=j; } vector<int> ans; for(int i=0;i<n;++i){ ans.push_back(wh[i]); } return ans; }

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:26:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j=0;j<l.size();++j){
                     ~^~~~~~~~~
#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...