Submission #1018685

#TimeUsernameProblemLanguageResultExecution timeMemory
1018685ProtonDecay314Unscrambling a Messy Bug (IOI16_messy)C++17
0 / 100
1 ms352 KiB
// AM+DG /* */ #include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<ll> vll; typedef vector<vll> vvll; typedef vector<int> vi; typedef vector<vi> vvi; typedef pair<int, int> pi; typedef pair<ll, ll> pll; typedef vector<pi> vpi; typedef vector<pll> vpll; #define L(i, varmn, varmx) for(ll i = varmn; i < varmx; i++) #define LR(i, varmx, varmn) for(ll i = varmx; i > varmn; i--) #define LI(i, varmn, varmx) for(int i = varmn; i < varmx; i++) #define LIR(i, varmx, varmn) for(int i = varmx; i > varmn; i--) #define pb push_back #include "messy.h" // #define DEBUG string to_binstring(int num, int n) { string res; LI(i, n - 1, -1) { res.pb(((num >> i) & 0b1 ? '1' : '0')); } return res; } vi restore_permutation(int n, int w, int r) { LI(i, 0, n + 1) { // Construct a string with this many zeros string elem; LI(j, 0, i) { elem.pb('1'); } LI(j, i, n) { elem.pb('0'); } add_element(elem); } compile_set(); int cur_mask = 0; vi ans(n, 0); LI(i, 0, n) { LI(j, 0, n) { if(((cur_mask >> j) & 0b1) == 0) { if(check_element(to_binstring(cur_mask | (1 << j), n))) { // We found the next bitpos cur_mask |= (1 << j); ans[i] = j; break; } } } } return ans; } #ifdef DEBUG int main() { } #endif
#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...