제출 #912275

#제출 시각아이디문제언어결과실행 시간메모리
912275TienDungz순열 (APIO22_perm)C++17
컴파일 에러
0 ms0 KiB
// #include "perm.h"
#include <bits/stdc++.h> 
using namespace std;

std::vector<int> construct_permutation(long long n)
{
    vector<int> res;
    int p = 0;
    for (int j = 60; j >= 0; j--) {
        int m = 1LL << j;
        if (n - m >= 0) {
            n -=m;
            if (ok) {
                ok = false;
                for (int i = 1; i <= j; i++) {
                    res.push_back(2 * i);
                }
                p = j;
            } else {
                res.push_back(2 * j + 1);
            }
        }
    }
    return res;
}

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

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:13:17: error: 'ok' was not declared in this scope
   13 |             if (ok) {
      |                 ^~