Submission #985555

#TimeUsernameProblemLanguageResultExecution timeMemory
985555ParsaGolestaniPermutation (APIO22_perm)C++17
91.33 / 100
3 ms500 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; const int N = 2'000'0000; vector<int> makeOk(deque<int> dq) { vector<int> vec1, vec2; for (int i = 0; i < dq.size(); i++) vec1.push_back(dq[i]); sort(vec1.begin(), vec1.end()); for (int i = 0; i < dq.size(); i++) vec2.push_back(lower_bound(vec1.begin(), vec1.end(), dq[i]) - vec1.begin()); return vec2; } vector<int> construct_permutation(ll k) { deque<int> dq; int bit = 63 - __builtin_clzll(k); if ((k & (1ll << (bit - 1)))) { dq.push_back(1); dq.push_back(0); } else dq.push_back(0); int pnt = 0; for (int j = bit - 2; j >= 0; j--) { dq.push_front(--pnt); if ((k & (1ll << j))) dq.push_back(--pnt); } return makeOk(dq); }

Compilation message (stderr)

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