This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
#include <set> | |
using std::multiset; | |
const int N = 100000 + 9; | |
int col[N],n,son[N],lnk[N * 2],nxt[N * 2],fa[N],ec; | |
struct info | |
{ | |
int l[N],r[N],p[N],max[N],v[N]; | |
multiset<int>s[N]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
const int N = 100000 + 9; | |
int lc[N * 2],rc[N * 2],Max[N * 2],n,ec,son[N],fa[N],tp[N],rt[N],d[N],nxt[N * 2],head[N * 2],lnk[N * 2],cost[N * 2],tot[N],maxch[N],sz[N],c[N]; | |
int L,R,cnt,t[N]; | |
char s[100]; | |
int build(const int l,const int r) | |
{ | |
int idx = ++cnt; | |
if (l == r) {Max[idx] = c[t[l]];return idx;} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
const int N = 10009; | |
int f[N][15],dep[N],dist[N],n,ec,son[N],lnk[N * 2],nxt[N * 2],len[N * 2]; | |
void dfs(const int u) | |
{ | |
for (int v,i = son[u]; i; i = nxt[i]) { | |
if ((v = lnk[i]) == f[u][0]) continue; | |
f[v][0] = u; | |
dep[v] = dep[u] + 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <queue> | |
using std::priority_queue; | |
const int N = 100000 + 9,INF = 0x3f3f3f3f; | |
int son[N],nxt[N * 2],lnk[N * 2],len[N * 2],dis[N],ec; | |
struct info | |
{ | |
int u,dis; | |
info(const int _u = 0,const int _dis = 0): | |
u(_u),dis(_dis){} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
#include <queue> | |
using std::priority_queue; | |
const int N = 100000 + 9,INF = 0x3f3f3f3f; | |
bool iscenter[N]; | |
int n,son[N],lnk[N * 2],nxt[N * 2],ec,cnt,times[N],col[N]; | |
struct info | |
{ | |
int u,dis; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
const int N = 100009; | |
int ec,son[N],lnk[N * 2],nxt[N * 2],col[N],fa[N]; | |
struct lct | |
{ | |
int l[N],r[N],p[N],sz[N],w[N]; | |
void init(int n) | |
{ | |
++n; | |
for (int i = 0; i <= n; ++i) l[i] = r[i] = p[i] = sz[i] = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
#include <set> | |
using std::multiset; | |
const int N = 100000 + 9; | |
int col[N],n,son[N],lnk[N * 2],nxt[N * 2],fa[N],ec; | |
struct info | |
{ | |
int l[N],r[N],p[N],max[N],v[N]; | |
multiset<int>s[N]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
const int N = 200009; | |
int col[N],c[N * 2],In[N],Ou[N],f[N][20],tot[N],d[N],top[N],Max[N],rt[N],sz[N],n,n2,m,lc[N * 2],rc[N * 2],add[N * 2][2],cnt,t[N]; | |
int L,R,V,son[N],lnk[N * 2],nxt[N * 2],ec; | |
inline void addedge(const int x,const int y) | |
{ | |
nxt[++ec] = son[x]; | |
son[x] = ec; | |
lnk[ec] = y; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
const int N = 500000 * 2 + 9; | |
char s[N],r[N]; | |
int n,len[N],fa[N],ans; | |
void init() | |
{ | |
len[0] = 0; | |
for (int i = 1,mp = 0; i < n; ++i) { | |
if (mp + len[mp] >= i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdio> | |
#include <algorithm> | |
#include <cstring> | |
const int N = 500000 + 9; | |
int f[N]; | |
char s[N]; | |
struct SAM | |
{ | |
int l[N],ch[N][26],fa[N],cnt,S,n,r[N],last; | |
void add(char cc) |
OlderNewer