here:https://oi-wiki.org/string/sam/ 下面转自 KesdiaelKen的雷蒻论坛 来个广义后缀自动机模板题 [USACO17DEC]Standing Out from the Herd #include <bits/stdc++.h> using namespace std; const int MAXN = 100005; int n, l[MAXN], m, s[MAXN]; long long ans[MAXN]; namespace SAM { co…
建出广义SAM,通过parent树对每个节点求出其是否仅被一个子串包含及被哪个包含. 写了无数个sam板子题一点意思都没啊 #include<bits/stdc++.h> using namespace std; #define ll long long #define inf 1000000010 #define N 200010 char getc(){char c=getchar();while ((c<'A'||c>'Z')&&(c<'a'||c>…
[199-Binary Tree Right Side View(从右边看二叉树] [LeetCode-面试算法经典-Java实现][全部题目文件夹索引] 代码下载[https://github.com/Wang-Jun-Chao] 原题 Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from to…