Submission #744689

#TimeUsernameProblemLanguageResultExecution timeMemory
744689josanneo22순열 (APIO22_perm)C++17
91.33 / 100
2 ms340 KiB
#include <bits/stdc++.h> #include<unordered_map> #include<unordered_set> #include<algorithm> using namespace std; #define mp make_pair #define pb push_back #define pii pair<int,int> #define fi first #define se second #include <vector> std::vector<int> construct_permutation(long long k); std::vector<int> construct_permutation(long long k) { int bt = 0; while ((1LL<<bt) <= k) bt++; bt--; std::vector<int> a(bt, -1); for (int i = bt - 1; i >= 0;i--) { if ((1LL << i) & k) { a[i] = bt++; } } std::vector<int> ans; for (int i = 0; i < a.size(); i++) { if(a[i]!=-1) ans.push_back(a[i]); ans.push_back(i); } return ans; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:27:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   27 |  for (int i = 0; i < a.size(); i++) {
      |                  ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...