답안 #1035332

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1035332 2024-07-26T09:29:45 Z amine_aroua 순열 (APIO22_perm) C++17
64.6154 / 100
10 ms 1624 KB
#include "perm.h"
#include<bits/stdc++.h>
using namespace std;
#define ll long long
std::vector<int> construct_permutation(long long k)
{
	k--;
	int n = 0;
    vector<int> bits;
	for(ll i = 0 ; i < 60 ; i++)
	{
		if((1ll<<i) & k)
		{
            bits.push_back(i);
			n+=i + 1;
		}
	}
    n--;
    vector<int> perm;
    for(auto i : bits)
    {
        for(int j = n - i + 1 ; j <= n ; j++)
        {
            perm.push_back(j);
        }
        n-=i;
    }
    while(n >= 0)
    {
        perm.push_back(n);
        n--;
    }
    return perm;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Partially correct 1 ms 484 KB Partially correct
4 Partially correct 3 ms 348 KB Partially correct
5 Partially correct 5 ms 860 KB Partially correct
6 Partially correct 3 ms 688 KB Partially correct
7 Partially correct 10 ms 856 KB Partially correct
8 Partially correct 7 ms 1116 KB Partially correct
9 Partially correct 1 ms 348 KB Partially correct
10 Partially correct 8 ms 1624 KB Partially correct
11 Partially correct 6 ms 1112 KB Partially correct
12 Partially correct 7 ms 1044 KB Partially correct
13 Partially correct 7 ms 1116 KB Partially correct