Submission #746970

#TimeUsernameProblemLanguageResultExecution timeMemory
746970snpmrnhlolPermutation (APIO22_perm)C++17
91.33 / 100
3 ms428 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; vector <int> v; map <ll,ll> f; std::vector<int> construct_permutation(ll k) { v.clear(); ll i,j,cnt = 0; i = j = 0; while(k > 1){ if(k%2 == 1){ v.push_back(1000 - j++); } v.push_back(i++); k/=2; } f.clear(); ll cnt2 = 0; //for(auto i:v)cout<<i<<' '; for(auto i:v)f[i] = 1; for(auto &i:f)i.second = cnt2++;//,cout<<i.first<<' '; for(auto &i:v)i = f[i]; //for(auto i:v)cout<<i<<' '; return v; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(ll)':
perm.cpp:10:12: warning: unused variable 'cnt' [-Wunused-variable]
   10 |     ll i,j,cnt = 0;
      |            ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...