Submission #66864

#TimeUsernameProblemLanguageResultExecution timeMemory
66864MKopchevUnscrambling a Messy Bug (IOI16_messy)C++14
20 / 100
4 ms640 KiB
#include<bits/stdc++.h> #include "messy.h" using namespace std; /* set<string> q; void add_element(string s) { cout<<"add "<<s<<endl; q.insert(s); } void compile_set() { } bool check_element(string s) { cout<<"ask "<<s<<endl; if(q.count(s))return 1; return 0; } */ bool check(string s) { bool ret=check_element(s); return ret; } vector<int> restore_permutation(int n, int w, int r) { string s={}; for(int i=0;i<n;i++)s=s+"1"; for(int i=0;i<n;i++) { s[i]='0'; add_element(s); } compile_set(); vector<int> result={}; for(int i=0;i<n;i++)result.push_back(-1); for(int i=0;i<n;i++) { string s=""; for(int j=0;j<n;j++)s=s+"1"; for(int j=0;j<i;j++) s[result[j]]='0'; for(int j=0;j<n;j++) if(s[j]=='1') { s[j]='0'; r--; assert(r>=0); if(check(s)) { result[i]=j; break; } s[j]='1'; } while(result[i]==-1); } return result; } /* int main() { for(auto k:restore_permutation(4,16,16))cout<<k<<endl; } */

Compilation message (stderr)

messy.cpp: In function 'std::vector<int> restore_permutation(int, int, int)':
messy.cpp:47:9: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
         for(int j=0;j<n;j++)
         ^~~
messy.cpp:60:13: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
             while(result[i]==-1);
             ^~~~~
#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...