@@ -17,13 +17,13 @@ struct perm_tree {
1717 };
1818 vector<node> p;
1919 int root;
20- vector<vi > ch;
20+ vector<basic_string< int > > ch;
2121 bool touches (int u, int v) {
2222 return p[u].mn_num == p[v].mn_num + p[v].len ||
2323 p[v].mn_num == p[u].mn_num + p[u].len ;
2424 }
2525 int allocate (int mn_i, int mn_v, int ln, bool join,
26- const vi & chs) {
26+ const basic_string< int > & chs) {
2727 p.push_back ({mn_i, mn_v, ln, join});
2828 ch.push_back (chs);
2929 return sz (ch) - 1 ;
@@ -50,7 +50,7 @@ struct perm_tree {
5050 if (!empty (ch[u]) && touches (ch[u].back (), v)) {
5151 p[u].mn_num = min (p[u].mn_num , p[v].mn_num );
5252 p[u].len += p[v].len ;
53- ch[u]. push_back (v) ;
53+ ch[u] += v ;
5454 v = u;
5555 st.pop_back ();
5656 continue ;
@@ -73,7 +73,7 @@ struct perm_tree {
7373 break ;
7474 }
7575 int min_num = p[v].mn_num ;
76- vi chs (1 + sz (st) - idx, v);
76+ basic_string< int > chs (1 + sz (st) - idx, v);
7777 rep (j, idx, sz (st)) min_num =
7878 min (min_num, p[chs[j - idx] = st[j][0 ]].mn_num );
7979 v = allocate (l, min_num, i - l + 1 , 0 , chs);
0 commit comments