Submission #1049166

#TimeUsernameProblemLanguageResultExecution timeMemory
1049166Maite_MoralePermutation (APIO22_perm)C++17
0 / 100
0 ms348 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define vll vector<ll> std::vector<int> construct_permutation(long long k){ vll r;ll b=0;ll c=0;ll mn=0; vector<int> ans; for(int i=60;i>=0;i--){ if(b==1){ r.push_back(c);c++; if(k&(1LL<<i)){ r.push_back(-c); mn=-c; } } if(k&(1LL<<i)){ b=1;//cout<<i<<"*-*"; } } for(int i=0;i<r.size();i++){ ans.push_back(r[i]-mn); //cout<<ans.back()<<" "; }//cout<<"\n"; return ans; }

Compilation message (stderr)

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