Submission #139806

#TimeUsernameProblemLanguageResultExecution timeMemory
139806KalasLavasUnscrambling a Messy Bug (IOI16_messy)C++14
38 / 100
3 ms404 KiB
#include <bits/stdc++.h> #include "messy.h" std::mt19937 rng(std::chrono::system_clock::now().time_since_epoch().count()); using namespace std; #define IO ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define y1 asjfkgasj #define all(v) (v).begin(),(v).end() #define pb push_back #define F first #define S second #define endl '\n' #define flsh '\n'<<flush #define mp make_pair #define mt make_tuple #define sz size #define pii pair<int,int> #define pll pair<long long,long long> #define vi vector<int> #define vll vector<long long> #define deb(x) cout<< #x <<'='<< x <<flsh; #define iii int,int,int #define ull unsigned long long #define intt long long #define ld long double #define dd double #define OK cout<<"OK\n"<<flsh; #define setpre(x) fixed<<setprecision(x) #define mmset(x,y) memset(x,y,sizeof(x)) vi ans; string s; int c[128]; vi restore_permutation(int n, int w, int r) { ans.resize(n); for(int i=0;i<n;i++) s+='0'; for(int i=0;i<n;i++) { s[i]='1'; add_element(s); } compile_set(); for(int i=0;i<n;i++) s[i]='0'; for(int j=0;j<n;j++){ mmset(c,0); while(1) { int i=rng()%n; if(s[i]=='0' and !c[i]) { s[i]='1'; if(check_element(s)) { ans[i]=j; break; } else s[i]='0'; } c[i]=1; } //cout<<s<<endl; } //for(int i :ans) cout<<i<<' '; 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...