Submission #912270

#TimeUsernameProblemLanguageResultExecution timeMemory
912270TienDungzPermutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include "perm.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; typedef long double ld; ll MOD = 1e9+7; double eps = 1e-12; #define fi first #define se second #define INF 2e18 #define int long long int t, n; int pre[201]; // signed main() // { // ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); // // #ifndef ONLINE_JUDGE // // freopen("input.txt", "r", stdin); // // freopen("output.txt", "w", stdout); // // #endif // cin >> t; // while (t--) { // bool ok = true; // cin >> n; // vector<int> res; // int cnt = 0; // 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); // } // } // } // cout << res.size() << '\n'; // for (int i = 0; i < res.size(); i++) { // cout << res[i] << ' '; // } // cout << '\n'; // } // } std::vector<int> construct_permutation(long long n) { vector<int> res; int cnt = 0; 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; }

Compilation message (stderr)

perm.cpp:57:18: error: ambiguating new declaration of 'std::vector<long long int> construct_permutation(long long int)'
   57 | std::vector<int> construct_permutation(long long n)
      |                  ^~~~~~~~~~~~~~~~~~~~~
In file included from perm.cpp:1:
perm.h:3:18: note: old declaration 'std::vector<int> construct_permutation(long long int)'
    3 | std::vector<int> construct_permutation(long long k);
      |                  ^~~~~~~~~~~~~~~~~~~~~
perm.cpp: In function 'std::vector<long long int> construct_permutation(long long int)':
perm.cpp:66:21: error: 'ok' was not declared in this scope
   66 |                 if (ok) {
      |                     ^~
perm.cpp:60:13: warning: unused variable 'cnt' [-Wunused-variable]
   60 |         int cnt = 0;
      |             ^~~