# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
972881 | 2024-05-01T09:26:07 Z | vjudge1 | Permutation (APIO22_perm) | C++17 | 3 ms | 600 KB |
#include "perm.h" #include <bits/stdc++.h> using namespace std; #define scd(t) scanf("%d", &t) #define sclld(t) scanf("%lld", &t) #define forr(i, j, k) for (int i = j; i < k; i++) #define frange(i, j) forr(i, 0, j) #define all(cont) cont.begin(), cont.end() #define mp make_pair #define pb push_back #define f first #define s second typedef long long int lli; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<bool> vb; typedef vector<lli> vll; typedef vector<string> vs; typedef vector<pii> vii; typedef vector<vi> vvi; typedef map<int, int> mpii; typedef set<int> seti; typedef multiset<int> mseti; typedef long double ld; vi insert(vi vec, int id, int v) { vi out; frange(i, id) { out.pb(vec[i]); } out.pb(v); forr(i, id, vec.size()) { out.pb(vec[i]); } return out; } vi construct_permutation(long long k) { vi vec; int n = 0; vi out; for(int i=60; i>=0; i--) { if(k&(1LL<<i)) { frange(j, i) { out.pb(j); } n = i; break; } } int id = n-1; for(int i=id; i>=0; i--) { if(k&(1LL<<i)) { out = insert(out, i, n); n++; } } // printf("%lld\n", k); // for(auto e : out) printf("%d ", e); // printf("\n"); return out; }
Compilation message
# | 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 | Correct | 1 ms | 348 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Partially correct | 2 ms | 348 KB | Partially correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 2 ms | 348 KB | Output is correct |
8 | Partially correct | 2 ms | 600 KB | Partially correct |
9 | Correct | 1 ms | 420 KB | Output is correct |
10 | Partially correct | 2 ms | 528 KB | Partially correct |
11 | Partially correct | 3 ms | 348 KB | Partially correct |
12 | Partially correct | 2 ms | 348 KB | Partially correct |
13 | Partially correct | 2 ms | 344 KB | Partially correct |