Submission #1226823

#TimeUsernameProblemLanguageResultExecution timeMemory
1226823cpdreamerPermutation (APIO22_perm)C++20
Compilation error
0 ms0 KiB
#include "perm.h" #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; const long long INF = 1e17; typedef long long ll; const ll MOD = 998244353; #define F first #define pb push_back #define S second #define P pair #define V vector #define all(v) v.begin(), v.end() std::vector<int> construct_permutation(long long k) { k--; if (k==1) { return {0}; } int id=mx(k); V<int>vp; int g=0; for (int i=0;i<id;i++) { vp.pb(i+g); if (((1LL<<(i+1))&k)!=0 && i+1!=id) { g++; } } int num=1; if ((k&1)!=0) { num++; } for (int i=id-1;i>=1;i--) { if (((1LL<<i)&k)!=0) { vp.pb(vp[i-1]+1); } } for (auto &u:vp) { u+=num; } for (int i=num-1;i>=0;i--) { vp.pb(i); } return vp; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:21:12: error: 'mx' was not declared in this scope
   21 |     int id=mx(k);
      |            ^~