Submission #724857

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
7248572023-04-16 05:41:27Batorgil952Permutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include "perm.h"
#include<vector>
std::vector<int> construct_permutation(long long k)
{
long long p=2, s=1, r=0;
while(k>p){
p*=2;
s++;
}
s--;
vector< int > v;
long long a[100], dp[100];
while(r==0){
v.clear();
a[0]=0;
for(long long i=0; i<s; i++){
a[i+1]=i;
}
long long ind=0;
do{
for(long long i=0; i<=s; i++){
dp[i]=0;
}
long long ss=0;
dp[0]=1;
for(long long i=1; i<=s; i++){
for(long long j=0; j<=i-1; j++){
if(a[j]<=a[i]) dp[i]+=dp[j];
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:12:2: error: 'vector' was not declared in this scope
   12 |  vector< int > v;
      |  ^~~~~~
perm.cpp:12:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from perm.h:1,
                 from perm.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from perm.h:1,
                 from perm.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
perm.cpp:12:10: error: expected primary-expression before 'int'
   12 |  vector< int > v;
      |          ^~~
perm.cpp:15:3: error: 'v' was not declared in this scope
   15 |   v.clear();
      |   ^
perm.cpp:39:10: error: 'next_permutation' was not declared in this scope; did you mean 'construct_permutation'?
   39 |   }while(next_permutation(a+1, a+s+1));
      |          ^~~~~~~~~~~~~~~~
      |          construct_permutation
perm.cpp:46:3: error: 'v' was not declared in this scope
   46 |   v.push_back(a[i]);
      |   ^
perm.cpp:48:9: error: 'v' was not declared in this scope
   48 |  return v;
      |         ^