Submission #982805

# Submission time Handle Problem Language Result Execution time Memory
982805 2024-05-14T18:21:56 Z vjudge1 Permutation (APIO22_perm) C++17
10 / 100
124 ms 12272 KB
#include "perm.h"

#include <bits/stdc++.h>

#define pb(x) push_back((x))
using namespace std;
using ll = long long;

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

	ll currSum = 1;
	for (int i = 0; currSum + (1 << i) <= k; i++) {
		x.pb(i);
		currSum += (1 << i);
	}

	for (int i = 1; i <= (k - currSum); i++) x.pb(-i);
	for (int& i : x) i += k - currSum;

	return x;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 124 ms 12272 KB Integer 7240 violates the range [1, 5000]
4 Halted 0 ms 0 KB -