Submission #968575

# Submission time Handle Problem Language Result Execution time Memory
968575 2024-04-23T16:06:42 Z batsukh2006 Permutation (APIO22_perm) C++17
Compilation error
0 ms 0 KB
#include<iostream>
#include<stdio.h>
#include<math.h>
#include<map>
#include<string>
#include<algorithm>
#include<vector>
#include<string.h>
#include<utility>
#include<set>
#include<cmath>
#include<queue>
#include<deque>
#include<functional>
#include<stack>
#include<limits.h>
#include<iomanip>
#include<unordered_map> 
#include<numeric>
#include<tuple>
using namespace std;
 
#define MOD 1000000007
#define int long long
#define endl '\n'
void solve(){
	int k; cin>>k;
	int lst=0,sum=0;
	for(long long i=0; i<60; i++){
		if(k&(1ll<<i)){
			lst=i;
			sum++;
		}
	}
	vector<int> v;
	int x=0,z=lst+sum-2;
	for(long long i=0; i<lst; i++,x++){
		if(k&(1ll<<i)){
			v.push_back(z);
			z--;
		}
		v.push_back(x);
	}
	for(auto x: v) cout<<x<<' ';
}
signed main(){
    // freopen("248.in", "r", stdin);
    // freopen("248.out", "w", stdout);
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    
    int t=1;
//    cin>>t;	
    while(t--){
        solve();
        cout<<endl;
    }
    return 0;
}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Compilation message

/usr/bin/ld: /tmp/ccFmWfO4.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/cc0Ni6s5.o:perm.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccFmWfO4.o: in function `main':
grader.cpp:(.text.startup+0x240): undefined reference to `construct_permutation(long long)'
collect2: error: ld returned 1 exit status