제출 #1168676

#제출 시각아이디문제언어결과실행 시간메모리
1168676mnbvcxz123순열 (APIO22_perm)C++20
컴파일 에러
0 ms0 KiB
#include "perm.h" #include <bits/stdc++.h> #define int long long #define sz(a) (int)a.size() #define all(a) a.begin(), a.end() #define rall(a) a.rbegin(), a.rend() using namespace std; vector<signed> construct_permutation(long long k){ k-=2; vector<int> sm(1000,0); vector<signed> v; sm[0]=1; v.push_back(0); int x=1; while(k>0){ for (int i = sz(v); i>=0; i--) { int s=1; for (int j = 0; j < i; j++) { if(v[j]<x) s+=sm[j]; } if(s<=k){ sm[x]+=s; v.insert(v.begin() + i, x); k-=s; ok=0; break; } } x++; } return v; }

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

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:28:33: error: 'ok' was not declared in this scope; did you mean 'k'?
   28 |                                 ok=0;
      |                                 ^~
      |                                 k