Submission #982747

#TimeUsernameProblemLanguageResultExecution timeMemory
982747vjudge1Permutation (APIO22_perm)C++17
91.33 / 100
2 ms348 KiB
// hola soy Dember :D // 31/03/2024 #include <bits/stdc++.h> #define ll long long #define pll pair<ll,ll> #define F first #define S second #define Z size() #define pb push_back #define bp pop_back #define fo(x,y,z) for(ll x=y; x<=z; x++) #define of(x,y,z) for(ll x=y; x>=z; x--) #define all(n) n.begin(), n.end() #define arr(x,y,z) x+y, x+y+z #define dd double using namespace std; vector<int> construct_permutation(ll k){ vector<int> ans, v; ll xd, zd; fo(i,0,__lg(k)) if((k>>i)&1)xd=i, v.pb(i); fo(i,0,xd-1)ans.pb(i); v.bp(); reverse(all(v)); for(auto u:v){ fo(i,u,ans.Z-1)ans[i]++; ans.pb(u); } return ans; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:13:32: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   13 | #define fo(x,y,z) for(ll x=y; x<=z; x++)
......
   34 |         fo(i,u,ans.Z-1)ans[i]++;
      |            ~~~~~~~~~~~          
perm.cpp:34:9: note: in expansion of macro 'fo'
   34 |         fo(i,u,ans.Z-1)ans[i]++;
      |         ^~
perm.cpp:23:12: warning: unused variable 'zd' [-Wunused-variable]
   23 |     ll xd, zd;
      |            ^~
perm.cpp:13:32: warning: 'xd' may be used uninitialized in this function [-Wmaybe-uninitialized]
   13 | #define fo(x,y,z) for(ll x=y; x<=z; x++)
      |                                ^~
perm.cpp:23:8: note: 'xd' was declared here
   23 |     ll xd, zd;
      |        ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...