이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "perm.h"
#include <iostream>
#include <iomanip>
#include <array>
#include <string>
#include <algorithm>
#include <cmath>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <vector>
#include <stack>
#include <queue>
#include <deque>
#include <bitset>
#include <list>
#include <iterator>
#include <numeric>
#include <complex>
#include <utility>
#include <random>
#include <fstream>
using namespace std;
/* -------------------- Typedefs -------------------- */
typedef int itn;
typedef long long ll;
typedef unsigned long long ull;
typedef double db;
typedef float fl;
typedef long double ld;
/* -------------------- Usings -------------------- */
using vi = vector<int>;
using vll = vector<ll>;
using mii = map<int, int>;
using mll = map<ll, ll>;
using pii = pair<int, int>;
using pll = pair<ll, ll>;
/* -------------------- Defines -------------------- */
#define ff first
#define ss second
#define pub push_back
#define pob pop_back
#define puf push_front
#define pof pop_front
#define mpr make_pair
#define yes cout<<"Yes\n"
#define no cout<<"No\n"
#define all(x) (x).begin(), (x).end()
/* -------------------- Constants -------------------- */
const int MAX = int(2e9 + 5);
const ll MAXL = ll(1e18) + 5ll;
const ll MOD = ll(1e9 + 7);
const ll MOD2 = ll(998244353);
std::vector<int> construct_permutation(long long k) {
vi answ = { 0,1,2,3,4,5,6,7,8,9, };
vi ans;
bitset<66> bit = k;
int beg = 0;
for (int i = 64; i >= 0; --i) {
if (!bit[i]) continue;
if (ans.empty()) {
for (int j = 0; j < i; ++j) ans.pub(j);
continue;
}
for (int j = i; j < ans.size(); ++j) ++ans[j];
ans.pub(i);
}
return ans;
}
컴파일 시 표준 에러 (stderr) 메시지
perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:75:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
75 | for (int j = i; j < ans.size(); ++j) ++ans[j];
| ~~^~~~~~~~~~~~
perm.cpp:68:6: warning: unused variable 'beg' [-Wunused-variable]
68 | int beg = 0;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |