Submission #1049133

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10491332024-08-08 13:48:45Marco_EscandonPermutation (APIO22_perm)C++17
91.33 / 100
3 ms492 KiB
//#include "perm.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
std::vector<int> construct_permutation(long long k)
{
vector<int> cad;
for(int i=0; i<64; i++)
{
cad.push_back(i);
}
ll k2=k;
ll p=64;
ll pl=0;
for(ll i=60; i>-1; i--)
{
if((k&(1LL<<i))!=0)
{
vector<int> cad2;
ll asdf=0;
for(int j=0; asdf<i-1+pl; j++)
{
if(cad[j]==asdf)
asdf++;
cad2.push_back(cad[j]);
}
cad2.push_back(p++);
for(int j=asdf; j<cad.size(); j++)
{
cad2.push_back(cad[j]);
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:28:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   28 |    for(int j=asdf; j<cad.size(); j++)
      |                    ~^~~~~~~~~~~
perm.cpp:41:16: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |  for(int i=0; i<cad.size(); i++)
      |               ~^~~~~~~~~~~
perm.cpp:12:5: warning: unused variable 'k2' [-Wunused-variable]
   12 |  ll k2=k;
      |     ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...