摘要: 题目链接题目都看不懂,做毛线。。。看懂了之后就是kmp出,所有的匹配区间,然后DP可以写,贪心也可以做把,DP应该需要优化一下,直接贪,也应该对的,经典贪心问题。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int s1[100001],s2[100001]; 8 int p[100001],o[100001]; 9 int next[100001];10 int flag[100001];11 int judge(int x,int y)12 {13 if(x == y... 阅读全文
posted @ 2013-09-23 15:32 Naix_x 阅读(442) 评论(0) 推荐(1) 编辑
摘要: 题目链接没有发现那个点,无奈。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 #define LL __int64 8 int o[10001],rank[10001]; 9 struct node 10 { 11 int u,v,w; 12 } edge[500001]; 13 int n,m; 14 int que[500001]; 15 LL ans[500001]; 16 bool cmp(node a,node b) 17 { 18 ... 阅读全文
posted @ 2013-09-23 11:30 Naix_x 阅读(446) 评论(0) 推荐(1) 编辑
摘要: 题目链接比赛时候,建图建错了。大体算法想到了,不过很多细节都没想好。 1 #include 2 #include 3 #include 4 #include 5 #include 6 using namespace std; 7 int flag[101]; 8 int p[101][101]; 9 int o[101][101];10 int n,z;11 void dfs(int x,int step)12 {13 int i;14 if(z) return ;15 for(i = 1; i <= n; i ++)16 {17 if... 阅读全文
posted @ 2013-09-23 11:29 Naix_x 阅读(193) 评论(0) 推荐(1) 编辑