Submission #911401

#TimeUsernameProblemLanguageResultExecution timeMemory
911401asdasdqwerPermutation (APIO22_perm)C++17
71.22 / 100
23 ms1372 KiB
#include <bits/stdc++.h> using namespace std; #define int int64_t vector<int32_t> construct_permutation(long long x) { if (x==2) { return {0}; } x--; vector<int32_t> out; __uint128_t ONE=1; int cnt=0; vector<int> v; for (int i=65;i>0;i--) { while (x >= (((ONE<<i)-1))) { v.push_back(i); x -= ((ONE<<i)-1); } } for (int i=1;i<=v.size();i++) { int start=(1e9-1e5)/i; for (int j=0;j<v[i-1];j++) { out.push_back(start+j); } } vector<int32_t> al=out; sort(al.begin(),al.end()); map<int,int> mp; for (int i=0;i<al.size();i++) { mp[al[i]]=i; } for (int32_t &x:out) { x = mp[x]; } return out; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:19:18: warning: comparison of integer expressions of different signedness: 'long long int' and '__int128 unsigned' [-Wsign-compare]
   19 |         while (x >= (((ONE<<i)-1))) {
      |                ~~^~~~~~~~~~~~~~~~~
perm.cpp:25:19: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::vector<long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 |     for (int i=1;i<=v.size();i++) {
      |                  ~^~~~~~~~~~
perm.cpp:36:19: warning: comparison of integer expressions of different signedness: 'int64_t' {aka 'long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     for (int i=0;i<al.size();i++) {
      |                  ~^~~~~~~~~~
perm.cpp:16:9: warning: unused variable 'cnt' [-Wunused-variable]
   16 |     int cnt=0;
      |         ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...