Submission #50339

#TimeUsernameProblemLanguageResultExecution timeMemory
50339faishol27Unscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
2 ms384 KiB
#include "messy.h" #include <bits/stdc++.h> using namespace std; vector<int>ans; string solve(int cnt, string s){ string ret = s; int len = s.length(); for(int i=0;i<len;i++){ if(ret[i]=='1') continue; ret[i] = '1'; if(check_element(ret)){ ans[i] = cnt-1; return ret; }else{ ret[i] = '0'; } } } void solve_last(int N){ bitset<300>stt; for(auto elm:ans) if(elm != -1) stt[elm] = 1; for(int i=0;i<N;i++){ if(ans[i] == -1){ for(int j=0;j<N;j++) if(stt[j]==0){ ans[i] = j; break; } } } } std::vector<int> restore_permutation(int N, int W, int R) { ans.resize(N, -1); string B = "", tmp = ""; for(int i=0;i<N;i++){ B += "0"; tmp += "0"; } for(int i=0;i<N-1;i++){ B[i] = '1'; add_element(B); } compile_set(); for(int i=1;i<N;i++){ tmp = solve(i, tmp); } solve_last(N); return std::vector<int>(ans); }

Compilation message (stderr)

messy.cpp: In function 'std::__cxx11::string solve(int, std::__cxx11::string)':
messy.cpp:24:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#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...