#include "comb/ascent-rgs.h"
#include "comb/word-stats.h"
#include "comb/comb-print.h"
#include "fxtio.h"
#include "fxttypes.h"
#include "jjassert.h"
#include "nextarg.h"
//% Statistics for ascent sequences.
//% Cf. the following OEIS sequences:
//% A218577:
//% triangle, length-n ascent sequences with maximal element k-1.
//% An ascent sequence is a sequence [d(1), d(2), ..., d(n)] where d(1)=0, d(k)>=0,
//% and d(k) <= 1 + asc([d(1), d(2), ..., d(k-1)]) and asc(.) counts the number
//% of ascents of its argument.
//% A137251: ascent sequences with k ascents.
//% A175579: ascent sequences with k zeros.
//% A218579: ascent sequences with position of last zero at index k-1.
//% A218580: ascent sequences with position of first occurrence of maximal value at index k-1.
//% A218581: ascent sequences with position of last occurrence of maximal value at index k-1.
// Cf. comb/descent-rgs-stats-demo.cc for stats for descent sequences
// Cf. comb/ascent-rgs-demo.cc
//#define TIMING // uncomment to disable printing
int
main(int argc, char **argv)
{
ulong n = 5;
NXARG(n, "Length of strings, n>=1");
ulong sq = 0;
NXARG(sq, "Select stats:\n"
" 0 ==> max element\n"
" 1 ==> number of ascents\n"
" 2 ==> number of descents\n"
" 3 ==> number of zeros\n" // same stats as 5
" 4 ==> number of fixed points\n" // same stats as 3
" 5 ==> number of maximal digits\n"
" 6 ==> position of last occurrence of zero\n"
" 7 ==> position of first occurrence of the maximal value\n"
" 8 ==> position of last occurrence of the maximal value\n"
" 9 ==> number of flat steps\n"
" 10 ==> number of even values\n"
// " 11 ==> number of \n"
);
ascent_rgs A(n);
word_stats W(A.data(), n);
ulong ct = 0;
ulong * st = new ulong[n+1]; // stats
for (ulong k=0; k