답안 #718372

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
718372 2023-04-04T01:10:45 Z lam 화성 (APIO22_mars) C++17
컴파일 오류
0 ms 0 KB
#include "perm.h"
#include <bits/stdc++.h>
#define ll long long
using namespace std;
vector<int> construct_permutation(long long k)
{
    vector <int> res;
    ll len = 0;
    while (1LL<<(len+1)<=k) len++;
//    cerr<<len<<endl;
    vector <int> a;
    for (int i=1; i<=len; i++) a.push_back(i-1);
    k-=(1LL<<len);
    while (k>0)
    {
        ll it = 0;
        while ((1LL<<(it+1))<= k)
        {
            it++;
        }
        k-= (1LL<<it);
        a.push_back(it);
    }
    int n=a.size();
    vector <int> d(n+1,0);
    for (int i=0; i<n; i++) d[a[i]] ++;
    for (int i=1; i<=n; i++) d[i]+=d[i-1];
    res.resize(n);
    for (int i=0; i<n; i++) res[i] = --d[a[i]];
//    for (int i:a) cerr<<i<<' '; cerr<<endl;
//    for (int i:res) cerr<<i<<' '; cerr<<endl;
    vector <int> v=res;
    sort(v.begin(),v.end());
    for (int i=0; i<n; i++) assert(v[i]==i);
    return res;
}

Compilation message

mars.cpp:1:10: fatal error: perm.h: No such file or directory
    1 | #include "perm.h"
      |          ^~~~~~~~
compilation terminated.