| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 586533 | jamezzz | Permutation (APIO22_perm) | C++17 | 10 ms | 348 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;
#define all(x) x.begin(),x.end()
#define pb push_back
typedef long long ll;
vector<int> construct_permutation(ll k){
vector<int> b4;
while(k){
b4.pb((int)(k%4));
k/=4;
}
vector<double> ans;
if(b4.back()==2)ans.pb(0);
else if(b4.back()==3)ans.pb(1),ans.pb(0);
b4.pop_back();
while(!b4.empty()){
if(b4.back()==0)ans.pb(1e9),ans.pb(1e9+1);
else if(b4.back()==1)ans.pb(1e9),ans.pb(1e9+1),ans.pb(-1);
else if(b4.back()==2)ans.pb(1e9),ans.pb(-1),ans.pb(1e9+1);
else{
int p0=-1,p1=1e9;
for(int i=0;i<ans.size();++i){
if(ans[i]==0)p0=i;
if(ans[i]==1)p1=i;
}
if(p1<p0)ans.pb(1e9),ans.pb(1e9+1),ans.pb(1.5);
else ans.pb(1e9),ans.pb(-1),ans.pb(1e9+1),ans.pb(-2);
}
b4.pop_back();
vector<double> srt;
for(auto x:ans)srt.pb(x);
sort(all(srt));
for(auto &x:ans)x=lower_bound(all(srt),x)-srt.begin();
}
return vector<int>(all(ans));
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
