제출 #821415

#제출 시각아이디문제언어결과실행 시간메모리
821415Hanksburger순열 (APIO22_perm)C++17
83.23 / 100
4 ms596 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; long long prime[5]={2, 3, 5, 7, 11}; vector<int> construct_permutation(long long k) { for (long long u=0; u<5; u++) { long long v=prime[u]; if (k%v==0) { long long cnt=0; while (k%v==0) { k/=v; cnt++; } if (k==1) { vector<int> res; for (long long i=0; i<cnt; i++) for (long long j=v-2; j>=0; j--) res.push_back(i*(v-1)+j); return res; } vector<int> res=construct_permutation(k); int sz=res.size(); for (long long j=0; j<cnt; j++) for (long long m=v-2; m>=0; m--) res.push_back(j*(v-1)+m+sz); return res; } } for (long long i=2, m=1; ; i*=2, m++) { if (i<k && i*2>k) { vector<int> res=construct_permutation(k-i+1); for (long long j=0; j<res.size(); j++) res[j]+=m; for (long long j=0; j<m; j++) res.push_back(j); return res; } } }

컴파일 시 표준 에러 (stderr) 메시지

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