Submission #912385

# Submission time Handle Problem Language Result Execution time Memory
912385 2024-01-19T11:02:20 Z huyngo Permutation (APIO22_perm) C++17
0 / 100
0 ms 348 KB
#include "perm.h"
#include <bits/stdc++.h>  
using namespace std;
using ll = long long;
using i64 = long long;
#define ln "\n"
#define all(x) (x).begin(), (x).end()
#define rep(i,a,b) for(int i=a; i<=b; ++i)

const int mxN = 1e6 + 5;
int n;

vector<int> construct_permutation(long long x) {
	vector<int> ans;
	vector<int> s;
	int l = 0, r = 0;
	while (x > 1) {
		if (x & 1) {
			ans.push_back(--l);
			s.push_back(l);
			--x;
		}
		else {
			ans.push_back(++r);
			s.push_back(r);
			x >>= 1;
		}
	}
	sort(all(s));
	s.erase(unique(all(s)), s.end());
	for (int& i : ans)
		i = lower_bound(all(s), i) - s.begin();
	return ans;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -