Submission #396865

#TimeUsernameProblemLanguageResultExecution timeMemory
396865rocks03Unscrambling a Messy Bug (IOI16_messy)C++14
49 / 100
2 ms332 KiB
#include<bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define ff first #define ss second #define pb push_back #define SZ(x) ((int)(x).size()) #define all(x) x.begin(), x.end() #define debug(x) cout << #x << ": " << x << " " #define nl cout << "\n" #define rep(i, a, b) for(int i = (a); i < (b); i++) #define per(i, a, b) for(int i = (a); i >= (b); i--) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void add_element(string x); void compile_set(); bool check_element(string x); vector<int> restore_permutation(int N, int W, int R){ string s = ""; rep(i, 0, N) s += '0'; rep(i, 0, N){ s[i] = '1'; add_element(s); } compile_set(); rep(i, 0, N) s[i] = '0'; vector<int> ans(N, -1); rep(i, 0, N){ vector<int> q; rep(j, 0, N){ if(s[j] == '1') continue; q.pb(j); } shuffle(all(q), rng); for(int j : q){ s[j] = '1'; if(check_element(s)){ ans[j] = i; break; } s[j] = '0'; } } return ans; }
#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...