摘要:1 #include 2 #define maxn 2000100 3 #define LL long long 4 using namespace std; 5 char str[maxn]; 6 LL num[1000]; 7 int main(){ 8 cin>>str; 9 int n=strlen(str); 10 LL ans=1;...
阅读全文
摘要:1 #include 2 #define INF 0x7fffffff 3 using namespace std; 4 const int MAXN = 50010;//点数 5 const int MAXM = 100100;//边数 6 struct Edge { 7 int to,next,val; 8 }edge[MAXM]; 9 int head...
阅读全文
摘要:先scc缩点,变成DAG,显然ans=入度为0的scc个数,每个scc的答案就是scc内点权最小的值。
阅读全文
摘要:问一个图,最少需要加多少条边,使得这个图强联通。 Tarjan缩点,重建图,令a=入度为0的scc个数,b=出度为0的scc个数,ans=max(a,b); 若图scc=1,本身强联通,ans=0;
阅读全文
摘要:爆搜,3^n枚举, DAG上最长路。 但是注意,并不是一个直接的dag,有完全相同的,合并成一个点。
阅读全文
摘要:对于关系图是无环的,递推。 对于关系图是有环的,高斯消元
阅读全文
摘要:http://acm.hdu.edu.cn/showproblem.php?pid=1814 输出最小字典序。
阅读全文
摘要:https://vjudge.net/contest/179241#problem/H 区间覆盖问题。 给k个闭区间,问最大不重叠覆盖长度 dp,离散化。
阅读全文
摘要:题目大意: 一段区间【l,r】的价值是 (sum[r]-sum[l-1])*mini(a[i],(l<=i<=r)) 求最大代价。 单调栈。 维护一个 val,l,r代表这个以这个val为最小值,最大覆盖区间是【l,r】 维护一个单调减栈(栈顶元素到栈底元素单调递减) 当新加入一个元素a[i],如果
阅读全文
摘要:Problem C. GCD Tree Input file: standard input Output file: standard output Time limit: 3 seconds Memory limit: 64 mebibytes Teacher Mai has a graph w
阅读全文
摘要:Problem G. Travelling Salesman Problem Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 64 mebibytes Teacher
阅读全文
摘要:Problem E. Arithmetic Sequence Input file: standard input Output file: standard output Time limit: 1 seconds Memory limit: 64 mebibytes A sequence b1,
阅读全文
摘要:Problem D.Too Simple Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 64 mebibytes Rhason Cheung had a simpl
阅读全文
摘要:Problem A. Expression Input file: standard input Output file: standard output Time limit: 1 second Memory limit: 64 mebibytes Teacher Mai has n number
阅读全文
摘要:Problem A. Athletic competition Input file: athletic.in Output file: athletic.out Elections are coming and the mayor of Bytetown decided to organize a
阅读全文
摘要:Problem D. Guessing game Input file: game.in Output file: game.out Byteman is playing a following game with Bitman. Bitman writes down some 1 000 000
阅读全文
摘要:Problem J. Sum of a subsequence Input file: sum.in Output file: sum.out We are given a sequence a1, a2, . . . , a2n. Your task is to find a subsequenc
阅读全文
摘要:HDU 6069 线性筛 数论 hdu 1839 hdu 3873 hdu 3966
阅读全文
摘要:http://acm.fzu.edu.cn/problem.php?pid=2282 F[i]=(i-1)(F[i-2]+F[i-1])
阅读全文
摘要:1 #include 2 #include 3 #include 4 #include 5 #define lson l,m,rt>1)); 21 sum[rt>1); 22 add[rt]=0; 23 } 24 } 25 void build(int l,int r,int rt){ 26 add[rt]=0; 27 i...
阅读全文
摘要:1 #include 2 #define maxn 100010 3 using namespace std; 4 int C[maxn],n,m; 5 inline int lowbit(int x){ return (x&-x);} 6 inline void update(int x,int d){ 7 while(x0){ 15 res+=C[x];...
阅读全文
摘要:1 #include 2 #define maxn 100100 3 using namespace std; 4 int row[maxn],col[maxn],K,n,m,Q,x1,x2,yy1,y2; 5 bool vis[maxn][3]; 6 inline int lowbit(int x){ return (x&-x);} 7 inline void update(in...
阅读全文
摘要:题目分析:http://acm.fzu.edu.cn/problem.php?pid=2278
阅读全文
摘要:题目链接:http://acm.fzu.edu.cn/problem.php?pid=2277 Problem Description There is a rooted tree with n nodes, number from 1-n. Root’s number is 1.Each node
阅读全文