Submission #982846

# Submission time Handle Problem Language Result Execution time Memory
982846 2024-05-14T19:51:49 Z alo_54 Permutation (APIO22_perm) C++17
0 / 100
0 ms 348 KB
#include "perm.h"
#include <bits/stdc++.h>
using namespace std;


std::vector<int> construct_permutation(long long k)
{
	vector <int> resp;

	long long cont = 0, prev = 1;

	while (prev <= k)
	{
		cont++;
		prev *= 2;
	}

	cont --;

	long long aux = pow(2, cont);
	int c =(int)(cont)+1;

	//cout<<"cont: "<<cont<<endl;

	for (long long i = aux + 1; i <= k; i ++)
	{
		resp.push_back((int)c);
		c++;
	}

	reverse(resp.begin(), resp.end());
	//print(resp);

	for (int i = 0; i < cont; i++)
	{
		resp.push_back(i);
	}

	


	return resp;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Integer 2 violates the range [0, 1]
2 Halted 0 ms 0 KB -