Submission #850041

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
8500412023-09-15 16:43:28AndreyPermutation (APIO22_perm)C++17
100 / 100
2 ms348 KiB
#include "perm.h"
#include<bits/stdc++.h>
using namespace std;
vector<int> construct_permutation(long long k) {
vector<int> ans(0);
vector<int> haha(0);
while(k > 0) {
haha.push_back(k%4);
k/=4;
}
reverse(haha.begin(),haha.end());
bool yeah = false;
if(haha[0] == 2) {
ans.push_back(0);
}
else if(haha[0] == 3) {
ans.push_back(1);
ans.push_back(0);
yeah = true;
}
for(int i = 1; i < haha.size(); i++) {
if(haha[i] == 0) {
ans.push_back(ans.size());
ans.push_back(ans.size());
}
else if(haha[i] == 1) {
ans.push_back(ans.size());
ans.push_back(ans.size());
for(int j = 0; j < ans.size(); j++) {
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:22:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |     for(int i = 1; i < haha.size(); i++) {
      |                    ~~^~~~~~~~~~~~~
perm.cpp:30:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |             for(int j = 0; j < ans.size(); j++) {
      |                            ~~^~~~~~~~~~~~
perm.cpp:37:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |             for(int j = 0; j < ans.size(); j++) {
      |                            ~~^~~~~~~~~~~~
perm.cpp:47:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   47 |                 for(int j = 0; j < ans.size(); j++) {
      |                                ~~^~~~~~~~~~~~
perm.cpp:56:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |                 for(int j = 0; j < ans.size(); j++) {
      |                                ~~^~~~~~~~~~~~
perm.cpp:61:34: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   61 |                 for(int j = 0; j < ans.size(); j++) {
      |                                ~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...