제출 #573143

#제출 시각아이디문제언어결과실행 시간메모리
573143dqhungdl순열 (APIO22_perm)C++17
91.33 / 100
2 ms352 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; int getBit(long long x, int k) { return (x >> k) & 1LL; } vector<int> construct_permutation(long long k) { if (!k) return {}; int last = 0; for (int i = 0; i <= 60; i++) if (getBit(k, i)) last = i; vector<int> rs(last); iota(rs.begin(), rs.end(), 0); for (int i = last - 1; i >= 0; i--) if (getBit(k, i)) { for (int j = i; j < rs.size(); j++) rs[j]++; rs.push_back(i); } // for (int x: rs) // cout << x << ' '; // cout << '\n'; return rs; }

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

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