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 <cstring> | |
#include <algorithm> | |
const int M = 300000 * 2 + 9,N = 100000 + 9; | |
struct Edge | |
{ | |
int x,y,c; | |
}et[M],en[M],eo[M]; | |
inline bool operator<(const Edge &lhs,const Edge &rhs){return lhs.c < rhs.c;} | |
int n,m,K,Map[N],p[N],num[N],fa[N],edge[N],cnt,val[N],root,d,depth[N],fa_edge[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 <cstring> | |
const int N = 1000000 + 9,MOD = 1000000000; | |
int f[N],son[N],lnk[N],nxt[N],v[N],fa[N],pre[N],n,wei[N],ec,m,k; | |
int tmp[100][100]; | |
bool mark[N]; | |
int getf(int x){return x == f[x] ? x : f[x] = getf(f[x]);} | |
inline void addedge(int x,int y,int z) | |
{ | |
nxt[++ec] = son[x]; |
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 <cstring> | |
#include <queue> | |
const int N = 509; | |
const int d[4][2] = {{-1,0},{0,1},{1,0},{0,-1}}; | |
int q[N*N*4][3],h,t,f[10][10][N*N],n,W,H,to[N*N][4],p[N*N],QQ[N*N],tmp[N*N],b[N*N],Q[N*N],used[N*N],Time,pre[N*N]; | |
char map[N][N]; | |
bool inq[N*N]; | |
inline int node(int x,int y){return (x - 1) * W + y;} | |
inline void Min(int &x,int y){if (x > y) x = 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> | |
#include <cstring> | |
const int N = 200000 + 50000 + 9; | |
char s[N]; | |
struct node | |
{ | |
int l,r,dis,sz,v; | |
node(){} | |
node(const int _l,const int _r,const int _dis,const int _sz,const int _v): |
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 = 1000000 * 2 + 9; | |
int f[N],vis[N],Time,b[N],t[N],n; | |
char s[N]; | |
int l[N],fa[N],ch[N][26],last,len,cnt; | |
void add(int c) | |
{ | |
int p = last,np = ++cnt; last = np; |
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 <cstring> | |
#include <algorithm> | |
const int N = 1100000 * 2 + 9; | |
int fa[N],l[N],ch[N][3],len,last,cnt; | |
int f[N],q[N],n,m,a[N]; | |
char s[N]; | |
void add(int c) | |
{ | |
int np = ++cnt,p = last; last = np; |
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 <cstring> | |
#include <algorithm> | |
const int N = 100000 * 2 + 9; | |
char s[N]; | |
struct SAM | |
{ | |
int l[N],fa[N],ch[N][26],cnt,len,last,b[N],t[N],mnl[N],cl[N]; | |
void init() | |
{ |
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 <cstring> | |
#include <algorithm> | |
const int N = 250000 * 2 + 9; | |
char s[N]; | |
struct SAM | |
{ | |
int l[N],ch[N][26],fa[N],cnt,len,last; | |
void init(){cnt = last = 1; len = 0;memset(ch[1],0,sizeof ch[1]);} | |
void add(int c) |
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 <cstring> | |
const int N = 90000 * 2 + 9; | |
char s[N]; | |
int l[N],fa[N],ch[N][26],len,last,cnt,ec; | |
int f[N]; | |
bool mark[N]; | |
void query(int k) | |
{ | |
for (int p = 1; k; ) |
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 <cstring> | |
#include <string> | |
using std::string; | |
const int N = 600000 * 2 + 9; | |
int mask; | |
char s[3000000 + 9]; | |
string chars; | |
void gets(int mask) | |
{ |
NewerOlder