Submission #1121804

#TimeUsernameProblemLanguageResultExecution timeMemory
1121804rahidilbayramliUnscrambling a Messy Bug (IOI16_messy)C++17
20 / 100
2 ms508 KiB
#include<bits/stdc++.h> #include "messy.h" #define ll long long #define ld long double #define vl vector<ll> #define vi vector<int> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define pb push_back #define sz(v) (ll)(v.size()) #define f first #define s second #define pii pair<int, int> #define pll pair<ll, ll> using namespace std; vector<int> restore_permutation(int n, int w, int r) { int pos = n - 1; string s = ""; for(int i = 0; i < n; i++) s += "0"; vector<string>vect; for(int i = 0; i < n; i++) { s[pos] = '1'; vect.pb(s); add_element(s); pos--; } compile_set(); vector<int>perm(n); for(int i = 0; i < n; i++) perm[i] = i + 1; set<ll>st; s = ""; for(int i = 0; i < n; i++) s += "0"; bool res; for(int i = n - 1; i >= 0; i--) { for(int j = 0; j < n; j++) { if(st.count(j)) continue; s[j] = '1'; res = check_element(s); if(res) break; s[j] = '0'; } for(int j = 0; j < n; j++) { if(st.count(j)) continue; if(s[j] == '1') { perm[i] = j; st.insert(j); break; } } } return perm; }
#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...