Submission #959329

#TimeUsernameProblemLanguageResultExecution timeMemory
959329zeta7532Permutation (APIO22_perm)C++17
100 / 100
1 ms384 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) { if(k==1) return {}; if(k==2) return {0}; if(k==3) return {1,0}; if(k%4==0){ vector<int> A=construct_permutation(k/4); A.push_back(A.size()); A.push_back(A.size()); return A; } if(k%4==1){ vector<int> A=construct_permutation(k/4); A.push_back(A.size()); A.push_back(A.size()); rep(i,A.size()) A[i]++; A.push_back(0); return A; } if(k%4==2){ vector<int> A=construct_permutation(k/4); A.push_back(A.size()); rep(i,A.size()) A[i]++; A.push_back(0); A.push_back(A.size()); return A; } if(k%4==3){ vector<int> A=construct_permutation(k/4); if(A.size()>=2){ ll id0=-1,id1=-1; rep(i,A.size()){ if(A[i]==0) id0=i; if(A[i]==1) id1=i; } if(id0>id1){ A.push_back(A.size()); A.push_back(A.size()); rep(i,A.size()) if(A[i]>=2) A[i]++; A.push_back(2); return A; } } A.push_back(A.size()); rep(i,A.size()) A[i]++; A.push_back(0); A.push_back(A.size()); rep(i,A.size()) A[i]++; A.push_back(0); return A; } }

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++)
......
   30 |      rep(i,A.size()) A[i]++;
      |          ~~~~~~~~~~           
perm.cpp:30:6: note: in expansion of macro 'rep'
   30 |      rep(i,A.size()) 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++)
......
   37 |      rep(i,A.size()) A[i]++;
      |          ~~~~~~~~~~           
perm.cpp:37:6: note: in expansion of macro 'rep'
   37 |      rep(i,A.size()) 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++)
......
   46 |             rep(i,A.size()){
      |                 ~~~~~~~~~~    
perm.cpp:46:13: note: in expansion of macro 'rep'
   46 |             rep(i,A.size()){
      |             ^~~
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++)
......
   53 |              rep(i,A.size()) if(A[i]>=2) A[i]++;
      |                  ~~~~~~~~~~   
perm.cpp:53:14: note: in expansion of macro 'rep'
   53 |              rep(i,A.size()) if(A[i]>=2) 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++)
......
   59 |      rep(i,A.size()) A[i]++;
      |          ~~~~~~~~~~           
perm.cpp:59:6: note: in expansion of macro 'rep'
   59 |      rep(i,A.size()) 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++)
......
   62 |      rep(i,A.size()) A[i]++;
      |          ~~~~~~~~~~           
perm.cpp:62:6: note: in expansion of macro 'rep'
   62 |      rep(i,A.size()) A[i]++;
      |      ^~~
perm.cpp:66:1: warning: control reaches end of non-void function [-Wreturn-type]
   66 | }
      | ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...