File: expl-18.cpp

package info (click to toggle)
libsdsl 2.1.1%2Bdfsg-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,992 kB
  • sloc: cpp: 42,286; makefile: 1,171; ansic: 318; sh: 201; python: 27
file content (19 lines) | stat: -rw-r--r-- 590 bytes parent folder | download | duplicates (18)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <sdsl/suffix_arrays.hpp>
#include <iostream>
#include <algorithm>

using namespace std;
using namespace sdsl;

int main()
{
    csa_wt<wt_huff<rrr_vector<63>>,4,8> csa; // 接尾辞配列
    construct(csa, "expl-18.cpp", 1);
    cout << "count(\"配列\") : " << count(csa, "配列") << endl;
    auto occs = locate(csa, "\n");
    sort(occs.begin(), occs.end());
    auto max_line_length = occs[0];
    for (size_t i=1; i < occs.size(); ++i)
        max_line_length = std::max(max_line_length, occs[i]-occs[i-1]+1);
    cout << "max line length : " << max_line_length << endl;
}