Submission #959234

#TimeUsernameProblemLanguageResultExecution timeMemory
959234zeta7532Permutation (APIO22_perm)C++17
71.22 / 100
11 ms1176 KiB
#include "perm.h" #include <bits/stdc++.h> #pragma GCC target("avx2") #pragma GCC optimize("O3") #pragma GCC optimize("unroll-loops") using namespace std; using ll = long long; const ll mod = 998244353; #define fi first #define se second #define rep(i,n) for(ll i=0;i<n;i++) #define all(x) x.begin(),x.end() #define faster ios::sync_with_stdio(false);cin.tie(nullptr) std::vector<int> construct_permutation(long long k) { vector<int> A; k--; while(k>0){ ll x=0; ll loop=0; while(1){ if(x*2+1>k) break; x=x*2+1; loop++; } k-=x; A.push_back(loop); } ll sum=0; rep(i,A.size()) sum+=A[i]; vector<int> ans(sum); ll now=0; rep(i,A.size()){ for(ll j=now;j<now+A[i];j++){ ans[j]=sum-now-A[i]+j-now; } now+=A[i]; } return ans; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:11:30: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 | #define rep(i,n) for(ll i=0;i<n;i++)
......
   31 |  rep(i,A.size()) sum+=A[i];
      |      ~~~~~~~~~~               
perm.cpp:31:2: note: in expansion of macro 'rep'
   31 |  rep(i,A.size()) sum+=A[i];
      |  ^~~
perm.cpp:11:30: warning: comparison of integer expressions of different signedness: 'll' {aka 'long long int'} and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   11 | #define rep(i,n) for(ll i=0;i<n;i++)
......
   34 |  rep(i,A.size()){
      |      ~~~~~~~~~~               
perm.cpp:34:2: note: in expansion of macro 'rep'
   34 |  rep(i,A.size()){
      |  ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...