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 GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#pragma GCC target("avx,avx2,fma,popcnt")
#include<bits/stdc++.h>
using namespace std;
#define all(fl) fl.begin(),fl.end()
#define pb push_back
#define fi first
#define se second
#define for1(i,j,k) for(int i=j;i<=k;i++)
#define for2(i,j,k) for(int i=j;i>=k;i--)
#define for3(i,j,k,l) for(int i=j;i<=k;i+=l)
#define lb lower_bound
#define ub upper_bound
#define sz(a) (int)a.size()
#define pii pair<int,int>
#define pli pair<long long,int>
#define gcd __gcd
#define lcm(x,y) x*y/__gcd(x,y)
#define lastbit(i) __builtin_ctz(i)
vector<int> construct_permutation(long long k){
if (k==1)return {};
if (k==2)return {0};
for(int pr:{2,3,5,7,11,13}){
if (k%pr==0&&k>pr){
vector<int>l=construct_permutation(k/pr);
vector<int>r=construct_permutation(pr);
for (auto &v:r){
v+=l.size();
}
l.insert(l.end(),all(r));
return l;
}
}
auto temp=construct_permutation(k>>1);
temp.pb(sz(temp));
for (auto &v:temp)v++;
temp.pb(0);
return temp;
}
/*signed main(){
ios_base::sync_with_stdio(0);
cin.tie(0);
//freopen(".INP","r",stdin);
//freopen(".OUT","w",stdout);
for1(i,2,100000){
vector<int>vl=construct_permutation(i);
vector<int>dp;
dp.resize(sz(vl));
long long ans=1;
for1(j,0,sz(vl)-1){
dp[j]=1;
for1(k,0,j-1){
if (vl[k]<vl[j]){
dp[j]+=dp[k];
}
}
ans+=dp[j];
}
if (ans!=i){
cout<<"vcl "<<i<<" "<<ans<<'\n';
for1(j,0,sz(vl)-1){
cout<<vl[j]<<" ";
}
return 0;
}
}
}*/
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |