Submission #1362759

#TimeUsernameProblemLanguageResultExecution timeMemory
1362759hihi0908Game (APIO22_game)C++20
Compilation error
0 ms0 KiB
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;

#define pb push_back

std::vector<int> construct_permutation(long long k) {
	vector<int> extra;
	long long sum = 0;

	if(k == 2){
		return {0};
	}
	vector<int> p;



	for(int d = min(k - 1, (long long)1e5); d >= 3; d--){
		while(k % d == 0){
			k /= d;
			extra.pb(d - 1);
		}
	}

	if(k == 2){
		int hi = extra.back();
		extra.pop_back();
		extra.pb(hi * k - 1);
	}else{
		extra.pb(k - 1);
	}

	for(int d : extra){
		int tmp = d;
		vector<int> bits;
		long long s = 0;
		while(d > 0){
			for(int i = 63 ; i >= 1; i--){
				if((1ll << i) - 1 <= d){
					bits.pb(i);
					d -= (1ll << i) - 1;
					s += i;
					break;
				}
			}
		}

		
		s--;
		for(int i : bits){
			int cnt = s - i + 1;
			for(int j = cnt; j <= s; j++)	p.pb(sum + j);

			s -= i;
		}
		sum += tmp;
	}


	return p;
}

Compilation message (stderr)

game.cpp:1:10: fatal error: perm.h: No such file or directory
    1 | #include "perm.h"
      |          ^~~~~~~~
compilation terminated.