Submission #969616

# Submission time Handle Problem Language Result Execution time Memory
969616 2024-04-25T11:08:02 Z dubabuba Permutation (APIO22_perm) C++17
91.3333 / 100
2 ms 600 KB
#include <bits/stdc++.h>
#include "perm.h"

using namespace std;

typedef long long i64;
typedef vector<int> vi;

const int mxLOG = 62;

vi construct_permutation(i64 k) {
	vi a;
	for(int i = mxLOG - 1; i >= 0; i--) {
		if((k & (1LL << i)) != (1LL << i)) continue;
		if(a.size() == 0) {
			for(int j = 0; j < i; j++)
				a.push_back(j);
			continue;
		}

		for(int &x : a)
			if(x >= i)
				x++;
		a.push_back(i);
	}
	return a;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 436 KB Output is correct
5 Partially correct 1 ms 348 KB Partially correct
6 Correct 1 ms 384 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Partially correct 2 ms 348 KB Partially correct
9 Correct 1 ms 344 KB Output is correct
10 Partially correct 2 ms 600 KB Partially correct
11 Partially correct 2 ms 348 KB Partially correct
12 Partially correct 1 ms 348 KB Partially correct
13 Partially correct 2 ms 348 KB Partially correct