Submission #704728

# Submission time Handle Problem Language Result Execution time Memory
704728 2023-03-02T20:57:15 Z beaconmc Mars (APIO22_mars) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
//#include "perm.h"


typedef long long ll;
#define FOR(i,x,y) for(ll i=x; i<y; i++)

using namespace std;


vector<int> construct_permutation(long long k)
{
	ll imp = k;
	vector<ll> ops;
	deque<ll> sus;

	while (k>1){
		if (k%3==0){
			ops.push_back(3);
			k/=3;
			continue;
		}
		if (k%2==0){
			ops.push_back(2);
			k /= 2;
		}else{
			ops.push_back(1);
			k -= 1;
		}
	}
	ll cur = 0;
	reverse(ops.begin(), ops.end());
	for (auto&i : ops){
		if (i==1) sus.push_front(cur);
		else if (i==2) sus.push_back(cur);
		else if (i==3) {
			sus.push_back(cur+1);
			sus.push_back(cur);
			cur++;
		}
		cur++;
	}
	vector<int> ans;
	for (auto&i : sus) ans.push_back(i);
	return ans;




}

int main(){
	vector<int> a = construct_permutation(28);
	for (auto&i : a){
		cout << i << endl;
	}
}

Compilation message

mars.cpp: In function 'std::vector<int> construct_permutation(long long int)':
mars.cpp:15:5: warning: unused variable 'imp' [-Wunused-variable]
   15 |  ll imp = k;
      |     ^~~
/usr/bin/ld: /tmp/ccJ62NYz.o: in function `main':
stub.cpp:(.text.startup+0x0): multiple definition of `main'; /tmp/ccrsVECz.o:mars.cpp:(.text.startup+0x0): first defined here
/usr/bin/ld: /tmp/ccJ62NYz.o: in function `main':
stub.cpp:(.text.startup+0x793): undefined reference to `process(std::vector<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::allocator<std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >, int, int, int, int)'
collect2: error: ld returned 1 exit status