Submission #740863

#TimeUsernameProblemLanguageResultExecution timeMemory
740863enerelt14Permutation (APIO22_perm)C++17
Compilation error
0 ms0 KiB
#include "perm.h" #include<bits/stdc++.h> #define ll long long using namespace std; vector<int> x; vector<int> construct_permutation(ll k){ if (k == 1)return {}; if (k == 2)return {0}; if (k == 3)return {1, 0}; if (k % 4 == 0){ x = construct_permutation(k / 4); x.pb(x.size()); x.pb(x.size()); return x; } if (k % 4 == 1){ x = construct_permutation(k / 4); for (int i = 0; i < x.size(); i++)x[i]++; x.pb(x.size() + 1); x.pb(x.size() + 1); x.pb(0); return x; } if (k % 4 == 2){ x = construct_permutation(k / 4); for (int i = 0; i < x.size(); i++)x[i]++; x.pb(x.size() + 1); x.pb(0); x.pb(x.size()); return x; } x = construct_permutation(k / 4); for (int i = 0; i < x.size(); i++)x[i] += 2; x.pb(1); x.pb(x.size() + 1); x.pb(0); x.pb(x.size()); return x; }

Compilation message (stderr)

perm.cpp: In function 'std::vector<int> construct_permutation(long long int)':
perm.cpp:12:5: error: 'class std::vector<int>' has no member named 'pb'
   12 |   x.pb(x.size());
      |     ^~
perm.cpp:13:5: error: 'class std::vector<int>' has no member named 'pb'
   13 |   x.pb(x.size());
      |     ^~
perm.cpp:18:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   18 |   for (int i = 0; i < x.size(); i++)x[i]++;
      |                   ~~^~~~~~~~~~
perm.cpp:19:5: error: 'class std::vector<int>' has no member named 'pb'
   19 |   x.pb(x.size() + 1);
      |     ^~
perm.cpp:20:5: error: 'class std::vector<int>' has no member named 'pb'
   20 |   x.pb(x.size() + 1);
      |     ^~
perm.cpp:21:5: error: 'class std::vector<int>' has no member named 'pb'
   21 |   x.pb(0);
      |     ^~
perm.cpp:26:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   26 |   for (int i = 0; i < x.size(); i++)x[i]++;
      |                   ~~^~~~~~~~~~
perm.cpp:27:5: error: 'class std::vector<int>' has no member named 'pb'
   27 |   x.pb(x.size() + 1);
      |     ^~
perm.cpp:28:5: error: 'class std::vector<int>' has no member named 'pb'
   28 |   x.pb(0);
      |     ^~
perm.cpp:29:5: error: 'class std::vector<int>' has no member named 'pb'
   29 |   x.pb(x.size());
      |     ^~
perm.cpp:33:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   33 |  for (int i = 0; i < x.size(); i++)x[i] += 2;
      |                  ~~^~~~~~~~~~
perm.cpp:34:4: error: 'class std::vector<int>' has no member named 'pb'
   34 |  x.pb(1);
      |    ^~
perm.cpp:35:4: error: 'class std::vector<int>' has no member named 'pb'
   35 |  x.pb(x.size() + 1);
      |    ^~
perm.cpp:36:4: error: 'class std::vector<int>' has no member named 'pb'
   36 |  x.pb(0);
      |    ^~
perm.cpp:37:4: error: 'class std::vector<int>' has no member named 'pb'
   37 |  x.pb(x.size());
      |    ^~