Submission #579800

#TimeUsernameProblemLanguageResultExecution timeMemory
579800peuchPermutation (APIO22_perm)C++17
10 / 100
1098 ms304 KiB
#include "perm.h" #include<bits/stdc++.h> using namespace std; std::vector<int> construct_permutation(long long k) { if(k == 1) return vector<int> (0); if(k == 2) return vector<int> (1); vector<int> ret; for(int i = 2; i * i <= k; i++){ if(k % i != 0) continue; vector<int> aux1 = construct_permutation(i); vector<int> aux2 = construct_permutation(k / i); if(ret.empty() || aux1.size() + aux2.size() < ret.size()){ ret.clear(); for(int i = 0; i < aux1.size(); i++) ret.push_back(aux1[i]); for(int i = 0; i < aux2.size(); i++) ret.push_back(aux2[i] + aux1.size()); } } if(ret.empty()){ ret = construct_permutation(k - 1); ret.insert(ret.begin(), ret.size()); } return ret; }

Compilation message (stderr)

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