Submission #299847

#TimeUsernameProblemLanguageResultExecution timeMemory
299847MatheusLealVUnscrambling a Messy Bug (IOI16_messy)C++17
38 / 100
2 ms384 KiB
#include <bits/stdc++.h> #include "messy.h" #define pb push_back using namespace std; std::mt19937 rng((int) std::chrono::steady_clock::now().time_since_epoch().count()); #define all(x) begin(x), end(x) vector<int> restore_permutation(int n, int w, int r) { string curr; for(int i = 0; i < n; i++) curr.pb('1'); vector<int> carass; for(int i = 0; i < n; i++) carass.pb(i); shuffle(all(carass), rng); for(auto i: carass){ curr[i] = '0'; add_element(curr); } compile_set(); set<int> caras; vector<int> p(n); for(auto i: carass){ string aux; for(int j = 0; j < n; j++){ if(caras.count(j))aux.pb('0'); else aux.pb('1'); } vector<int> pos; for(int j=0;j<n;j++)pos.pb(j); // shuffle(all(pos), rng); for(auto j: pos){ if(aux[j] == '1'){ string P = aux; P[j] = '0'; if(check_element(P)){ caras.insert(j); p[j]=i; break; } } } } // for(int i = 0; i < n; i++) cout<<p[i]<<" "; // cout<<"\n"; return p; }
#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...