| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 969660 | anton | 순열 (APIO22_perm) | C++17 | 10 ms | 1368 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "perm.h"
#include<bits/stdc++.h>
using namespace std;
#define pii pair<int, int>
#define ll long long
const int MAX_N = 1e3;
void add_k(ll k, int val, vector<int>& v){
if(k==0){
return;
}
if(k == 1LL){
v.push_back(val);
return;
}
else{
int w= 1;
ll m =2;
while(2LL*m -1LL <= k){
m*=2LL;
w++;
}
for(int i= 0; i<w; i++){
v.push_back(val-w+i+1);
}
add_k(k-(m-1), val-w, v);
}
}
std::vector<int> construct_permutation(long long k)
{
vector<int> res;
int reslen = 0;
add_k(k-1, 0, res);
int minv = 0;
for(auto e: res){
minv = min(minv, e);
}
for(int& e: res){
e -= minv;
}
return res;
}컴파일 시 표준 에러 (stderr) 메시지
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
| # | 결과 | 실행 시간 | 메모리 | 채점기 출력 |
|---|---|---|---|---|
| 결과를 불러오는 중입니다… | ||||
