Submission #874690

#TimeUsernameProblemLanguageResultExecution timeMemory
874690serifefedartarPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
//#include <perm.h>
using namespace std;

#define fast ios::sync_with_stdio(0);cin.tie(0);
#define s second
#define f first
typedef long long ll;
const ll MOD = 1e9+7;
const ll LOGN = 20; 
const ll MAXN = 1e5 + 100;

vector<int> construct_permutation(ll k) {
	deque<int> v;

	bool yes = false;
	int last = 1;
	for (ll i = 60; i >= 0; i--) {
		if ((1LL<<i) & k) {
			if (!yes) {
				yes = true;
				v.push_back(1);
			} else {
				last++;
				v.push_front(last);
				last++;
				if (i != 0)
					v.push_back(last);
			}
		} else if (yes) {
			if (i != 0) {
				last++;
				v.push_back(last); 
			}
		}
	}
	
	vector<int> P;
	for (auto u : v)
		P.push_back(u - 1);
	return P;
}

int main() {
	vector<int> v = construct_permutation(14); 
	for (auto u : v)
		cout << u << " ";
	cout << "\n";
}

Compilation message (stderr)

/usr/bin/ld: /tmp/ccvm7eck.o: in function `main':
grader.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccKf2Urj.o:perm.cpp:(.text.startup+0x0): first defined here
collect2: error: ld returned 1 exit status