Submission #1011598

#TimeUsernameProblemLanguageResultExecution timeMemory
1011598dimashhhPermutation (APIO22_perm)C++17
91.33 / 100
1 ms604 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; vector<int> ret,g; int hsb(ll x){ for(int i = 60;i >= 0;i--){ if((x >> i) & 1) return i; } } vector<int> construct_permutation(long long k) { ret.clear(); g.clear(); int f = hsb(k); for(int i = 0;i < f;i++){ g.push_back(i); } for(int i = f - 1;i >= 0;i--){ if((k >> i) & 1){ for(int j = i;j < (int)g.size();j++){ g[j]++; } for(int j = 0;j < (int)ret.size();j++){ if(ret[j] >= g[i] - 1){ ret[j]++; } } ret.push_back(g[i] - 1); } } for(int j:ret){ g.push_back(j); } // for(int j:g){ // cout << j << ' '; // } return g; }

Compilation message (stderr)

perm.cpp: In function 'int hsb(ll)':
perm.cpp:10:1: warning: control reaches end of non-void function [-Wreturn-type]
   10 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...