Submission #1268744

#TimeUsernameProblemLanguageResultExecution timeMemory
1268744BlockOGUnscrambling a Messy Bug (IOI16_messy)C++20
100 / 100
2 ms584 KiB
#include <bits/stdc++.h> // mrrrow meeow :3 // go play vivid/stasis now! it's free on steam #define fo(i, a, b) for (auto i = (a); i < (b); i++) #define of(i, a, b) for (auto i = (b); i-- > (a);) #define f first #define s second #define pb push_back #define pob pop_back #define lb lower_bound #define ub upper_bound #define be(a) a.begin(), a.end() using namespace std; int ____init = [] { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); return 0; }(); void add_element(string x); void compile_set(); bool check_element(string x); void fill(int l, int r, int n) { if (r - l <= 1) return; int m = (l + r) / 2; string thing, thing2; fo(_, 0, l) thing += '1'; fo(_, l + 1, n) thing2 += '0' + (_ >= r); fo(i, l, m) { add_element(thing + '1' + thing2); thing += '0'; thing2 = thing2.substr(1); } fill(l, m, n); fill(m, r, n); } void get(set<int> curr, int l, int r, int n, vector<int> &result) { if (r - l <= 1) { result[*curr.begin()] = l; return; } int m = (l + r) / 2; set<int> left, right; for (int i : curr) { string thing; fo(j, 0, n) thing += '0' + (!curr.count(j) || j == i); if (check_element(thing)) left.insert(i); else right.insert(i); } get(left, l, m, n, result); get(right, m, r, n, result); } vector<int> restore_permutation(int n, int w, int r) { fill(0, n, n); compile_set(); set<int> curr; fo(i, 0, n) curr.insert(i); vector<int> res(n); get(curr, 0, n, n, res); return res; }

Compilation message (stderr)

messy.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
messy_c.h:1:9: warning: #pragma once in main file
    1 | #pragma once
      |         ^~~~
#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...