제출 #740917

#제출 시각아이디문제언어결과실행 시간메모리
740917enerelt14순열 (APIO22_perm)C++17
0 / 100
1 ms212 KiB
#include "perm.h" #include<bits/stdc++.h> #define ll long long #define pb push_back using namespace std; vector<int> x; int n; vector<int> construct_permutation(ll k){ if (k == 1)return {}; if (k == 2)return {0}; if (k == 3)return {1, 0}; if (k % 4 == 0){ x = construct_permutation(k / 4); n = x.size(); x.pb(n); x.pb(n + 1); return x; } if (k % 4 == 1){ x = construct_permutation(k / 4); n = x.size(); for (int i = 0; i < n; i++)x[i]++; x.pb(n + 1); x.pb(n + 2); x.pb(0); return x; } if (k % 4 == 2){ x = construct_permutation(k / 4); n = x.size(); for (int i = 0; i < n; i++)x[i]++; x.pb(n + 1); x.pb(0); x.pb(n + 2); return x; } x = construct_permutation(k / 4); n = x.size(); int z, o; for (int i = 0; i < n; i++){ if (x[i] == 0)z = i; if (x[i] == 1)o = i; } if (z > o){ for (int i = 0; i < n; i++)if (x[i] > 1)x[i]++; x.pb(n + 1); x.pb(n + 2); x.pb(2); return x; } for (int i = 0; i < n; i++)x[i] += 2; x.pb(n + 2); x.pb(1); x.pb(n + 3); x.pb(0); return x; }

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

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:44:2: warning: 'z' may be used uninitialized in this function [-Wmaybe-uninitialized]
   44 |  if (z > o){
      |  ^~
perm.cpp:44:2: warning: 'o' may be used uninitialized in this function [-Wmaybe-uninitialized]
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...