Submission #582663

#TimeUsernameProblemLanguageResultExecution timeMemory
582663MadokaMagicaFanUnscrambling a Messy Bug (IOI16_messy)C++14
0 / 100
1 ms340 KiB
#include <bits/stdc++.h> using namespace std; using ll = long long; using vi = vector<int>; using pi = pair<int,int>; #define all(v) v.begin(),v.end() #define sort(v) sort(all(v)) #define endl '\n' #define forn(i,n) for(int i = 0; i < n; ++i) #define forbe(i,b,e) for(int i = b; i < e; ++i) #define forr(i,n) for(int i = n-1; i >= 0; --i) #define sz(v) ((int)v.size()) #define pb push_back #define f first #define s second void add_element(std::string x); bool check_element(std::string x); void compile_set(); std::vector<int> sub12(int n) { string x; forn(i,n) x.pb('0'); forn(i,n-1) { x[i] = '1'; add_element(x); } compile_set(); vector<bool> fnd(n); vi perm(n); forn(i,n) x[i] = '0'; forn(i,n-1) { forn(j,n) { if (fnd[j]) continue; x[j] = '1'; if (check_element(x)) { fnd[j] = 1; perm[j] = i; continue; } x[j] = '0'; } } forn(i,n) { if (fnd[i]) continue; perm[i] = n-1; } return perm; } std::vector<int> restore_permutation(int n, int w, int r) { if (n == 8) return sub12(n); else if (n == 32 && r == 1024) return sub12(n); return sub12(n); vi ans; return ans; } #ifdef ONPC vi rperm; set<string> nmb; int _n; void add_element(std::string x) { string rs; forn(i,sz(x)) { rs.pb('0'); rs[i] = x[rperm[i]]; } cout << x << ' ' << rs << endl; nmb.insert(rs); } bool check_element(std::string x) { cout << x << ' ' << nmb.count(x) << endl; return nmb.count(x);} void compile_set() {} void solve() { int n, w, r; cin >> n >> w >> r; _n = n; rperm.resize(n); forn(i,n) cin >> rperm[i]; vi ans = restore_permutation(n,w,r); forn(i,n) cout << ans[i] << ' '; cout << endl; } int main() { freopen("in", "r", stdin); // ios_base::sync_with_stdio(0);cin.tie(0); solve(); } #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...