This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma optimize("Bismillahirrahmanirrahim")
//█▀█─█──█──█▀█─█─█
//█▄█─█──█──█▄█─█■█
//█─█─█▄─█▄─█─█─█─█
//ahmet23 orz...
//FatihSultanMehmedHan(ortanca da orz)
//AbdulhamidHan
//YavuzSultanSelimHan
#define author tolbi
#include <bits/stdc++.h>
using namespace std;
template<typename X, typename Y> istream& operator>>(istream& is, pair<X,Y> &pr){return is>>pr.first>>pr.second;}
template<typename X, typename Y> ostream& operator<<(ostream& os, pair<X,Y> pr){return os<<pr.first<<" "<<pr.second;}
template<typename T> istream& operator>>(istream& is, vector<T> &arr){for (auto &it : arr) is>>it;return is;}
template<typename T> ostream& operator<<(ostream& os, vector<T> arr){for (auto &it : arr) os<<it<<" ";return os;}
template<typename T, size_t Y> istream& operator>>(istream& is, array<T,Y> &arr){for (auto &it : arr) is>>it;return is;}
template<typename T, size_t Y> ostream& operator<<(ostream& os, array<T,Y> arr){for (auto &it : arr) os<<it<<" ";return os;}
template<typename T> void coutarr(T __arr){for (auto &it : __arr){cout<<it<<" ";}cout<<endl;}
#define deci(x) int x;cin>>x;
#define decstr(x) string x;cin>>x;
#define endl '\n'
#define sortarr(x) sort(x.begin(), x.end())
#define sortrarr(x) sort(x.rbegin(), x.rend())
#define rev(x) reverse(x.begin(), x.end())
#define vint(x) vector<int> x
#define tol(bi) (1LL<<((int64_t)(bi)))
typedef long long ll;
const int MOD = 1e9+7;
mt19937 ayahya(chrono::high_resolution_clock().now().time_since_epoch().count());
#include <vector>
#include "messy.h"
std::vector<int> restore_permutation(int n, int w, int r) {
string str = string(n,'0');
for (int i = 0; i < n; i++){
str[i]='1';
add_element(str);
}
compile_set();
vector<int> rval(n,-1);
vector<bool> vis(n,false);
fill(str.begin(), str.end(), '0');
for (int i = 0; i < n; i++){
vector<int> hehe;
for (int j = 0; j < n; j++){
if (vis[j]) continue;
hehe.push_back(j);
}
for (int j = hehe.size()-1; j >= 0; j--){
swap(hehe[j],hehe[ayahya()%(j+1)]);
}
int lel = hehe.back();
hehe.pop_back();
bool boolean=false;
for (auto &j : hehe){
str[j]='1';
if (check_element(str)){
rval[j]=i;
vis[j]=true;
boolean=true;
break;
}
str[j]='0';
}
if (!boolean){
rval[lel]=i;
vis[lel]=true;
boolean=true;
str[lel]='1';
}
}
return rval;
}
Compilation message (stderr)
messy.cpp:1: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
1 | #pragma optimize("Bismillahirrahmanirrahim")
|
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |