제출 #716929

#제출 시각아이디문제언어결과실행 시간메모리
716929raysh07순열 (APIO22_perm)C++17
91.33 / 100
3 ms348 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; vector <int> ans; void dowork(int y){ for (int i=0; i<ans.size(); i++){ if (ans[i] >= y){ ans[i]++; } } } vector<int> construct_permutation(long long k) { ans.clear(); int last = -1; long long fk = k; for (int i=0; i<62; i++){ if (fk != 0){ if (fk >> i & 1) fk -= 1LL<<i; if (fk != 0) ans.push_back(i); last = i; } } for (int i=last - 1; i>=0; i--){ if (k >> i & 1){ dowork(i); ans.push_back(i); } } return ans; } // int main(){ // int k; cin>>k; // vector <int> ok = construct_permutation(k); // for (auto x: ok) cout<<x<<" "; // return 0; // }

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

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