Submission #911275

# Submission time Handle Problem Language Result Execution time Memory
911275 2024-01-18T17:30:17 Z tosivanmak Permutation (APIO22_perm) C++17
0 / 100
1 ms 348 KB
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const ll Log=15;
#define MAX 1e18
#define MOD 1000000007
typedef pair<ll,ll> LP;
#define ld long double

vector<ll>seq;
ll cur=1;
void bm(ll num){
    if(num==0){
        return;
    }
    if(num&1){
        bm(num/2);
        seq.push_back(cur);
        cur++;
    }
    else{
        bm((num-1)/2);
        seq.push_back(cur);
        seq.push_back(-cur);
        cur++;
    }
}
vector<int> construct_permutation(ll n){
   bm(n-1);
//    cout<<seq.size()<<'\n';
   vector<ll>seq2;
   for(auto& u: seq){
       seq2.push_back(u);
   }
   sort(seq2.begin(),seq2.end());
   vector<int>ans;
   for(auto& u: seq){
       ans.push_back(lower_bound(seq2.begin(),seq2.end(),u)-seq2.begin());
   }
   return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -