Submission #577298

# Submission time Handle Problem Language Result Execution time Memory
577298 2022-06-14T13:23:27 Z handlename Permutation (APIO22_perm) C++17
10 / 100
1 ms 332 KB
#include <bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
const int MOD=1e9+7;
long long num[64];
vector<int> construct_permutation(long long k){
	k--;
	num[0]=1;
	for (int i=1;i<64;i++){
		num[i]=num[i-1]*2;
	}
	vector<int> res;
	int cur=0;
	while (k>0){
		int pos=min((int)res.size(),63);
		while (k<num[pos]) pos--;
		res.insert(res.begin()+pos,cur);
		k-=num[pos];
		cur++;
	}
	return res;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 332 KB Output isn't correct
6 Halted 0 ms 0 KB -