Submission #709733

#TimeUsernameProblemLanguageResultExecution timeMemory
709733gun_ganPermutation (APIO22_perm)C++17
0 / 100
1 ms212 KiB
#include <bits/stdc++.h> using namespace std; typedef long long ll; static long long MX=1e18; vector<int> construct_permutation(long long k) { vector<vector<int>> ans; int last = 0; for(int i = 59; i >= 0; i -= 5) { ll cur = 0; for(int j = i, z = 4; j > i - 5; j--, z--) { cur += (k >> j & 1) << z; } if(k == 33) cout << i << " " << cur << '\n'; if(cur > 0) { ans.push_back({}); for(int j = 0; j < i - 4; j++) { ans.back().push_back(last); last++; } for(int j = 0; j <= cur - 1; j++) { ans.back().push_back(last + cur - j - 1); } last += cur - 1; } if(k == 33) { for(auto x : ans) { for(auto i : x) cout << i << " "; } cout << '\n'; } } vector<int> ret; for(auto x : ans) { for(auto i : x) ret.push_back(i); } return ret; } // long long count_increasing(vector<int>& v) { // vector<long long> dp(v.size() + 1, 0); // dp[0] = 1; // for (int x : v) // { // for (int i = 0; i <= x; i++) // { // dp[x+1] += dp[i]; // dp[x+1] = min(dp[x+1],MX+1); // } // } // long long result = 0; // for (int i = 0; i <= (int)v.size(); i++){ // result += dp[i]; // result = min(result,MX+1); // } // return result; // } // int main() { // cin.tie(0); ios_base::sync_with_stdio(0); // cout << (long long)(1LL << 55) * 24 - ((1LL << 59) + (1LL << 58)) << '\n'; // for(int i = 1; i <= 100; i++) { // auto v = construct_permutation(i); // if(count_increasing(v) != i) { // cout << i << '\n'; // for(auto x : v) cout << x << " "; // cout << '\n'; // break; // } // } // }

Compilation message (stderr)

perm.cpp:5:18: warning: 'MX' defined but not used [-Wunused-variable]
    5 | static long long MX=1e18;
      |                  ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...