# | TimeUTC-0 | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
742866 | Luicosas | Permutation (APIO22_perm) | C++17 | 2 ms | 340 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define sz(x) (int)(x.size())
#define itr(x) x.begin(), x.end()
#ifdef LOC
#define debug(...) cerr << #__VA_ARGS__ << " : "; for(auto& dval : {__VA_ARGS__}) cerr << dval << " "; cerr << "\n";
#else
#define debug(...)
#endif
template<typename T>
ostream& operator << (ostream& out, vector<T> vals) {
for(auto& i : vals) {
out << i << " ";
}
return out;
}
// i hypothesize that we can greedily append to a permutation the greatest number that will not make the increasing sequences > k and that this will terminate with at most 90 numbers
// we can get 2 ^ k - 1 with 1, 2, 3, 4, ... k
// n - (2 ^ k - 1) will not have a bit higher than k set
// 2 ^ k - 1 is what the numbers are
// so after we get close we can use the 2 ^ k - 1 and we do this at most k times?
// v*2 + 1, greatest will become (answer - 1) / 2
// v*2 - greatest
// + 1
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |