- 博客(29)
- 收藏
- 关注
原创 poj3160 Father Christmas flymouse(强连通图+dijkstra)
DescriptionAfter retirement as contestant from WHU ACM Team, flymouse volunteered to do the odds and ends such as cleaning out the computer lab for training as extension of his contribution to the te...
2019-02-28 16:42:52
208
原创 迷宫城堡hdu1269(强连通tarjan)
为了训练小希的方向感,Gardon建立了一座大城堡,里面有N个房间(N<=10000)和M条通道(M<=100000),每个通道都是单向的,就是说若称某通道连通了A房间和B房间,只说明可以通过这个通道由A房间到达B房间,但并不说明通过它可以由B房间到达A房间。Gardon需要请你写个程序确认一下是否任意两个房间都是相互连通的,即:对于任意的i和j,至少存在一条路径可以从房间i到房间j,...
2019-02-28 14:40:47
136
原创 hdu2767 Proving Equivalences(强连通tarjan+缩点)
Problem DescriptionConsider the following exercise, found in a generic linear algebra textbook.Let A be an n × n matrix. Prove that the following statements are equivalent:A is invertible.Ax = b ...
2019-02-27 21:25:15
158
原创 棋盘游戏
小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互相攻击。所以现在Gardon想让小希来解决一个更难的问题,在保证尽量多的“车”的前提下,棋盘里有些格子是可以避开的,也就是说,不在这些格子上放车,...
2019-02-06 13:27:40
709
原创 Taxi Cab Scheme(最小路径覆盖)
Running a taxi station is not all that simple. Apart from the obvious demand for a centralised coordination of the cabs in order to pick up the customers calling to get a cab as soon as possible, the...
2019-02-06 11:53:11
204
原创 Oil Skimming
Thanks to a certain "green" resources company, there is a new profitable industry of oil skimming. There are large slicks of crude oil floating in the Gulf of Mexico just waiting to be scooped up by ...
2019-02-06 10:54:07
323
原创 E2. Array and Segments (Hard version) 线段树
题目链接#include<bits/stdc++.h>using namespace std;vector<int>v[200001];const int sz=2*1e5+7;typedef long long ll;const int INF=0x3f3f3f3f;map<int,int>mp;int a[sz],b[sz],l[sz],r[...
2019-01-24 17:21:16
307
原创 Divisors of Two Integers div3
暴力枚举每一个点#include<bits/stdc++.h>using namespace std;vector<int>v[200001];const int sz=2*1e5+7;typedef long long ll;const int INF=0x3f3f3f3f;map<int,int>mp;int a[sz],b[sz],l[sz...
2019-01-24 17:19:41
174
原创 病毒侵袭持续中 hdu3065
题目链接这道题与hdu2222类似#include<stdio.h>#include<iostream>#include<algorithm>#include<math.h>#include<new>#include<queue>#include<string.h>#include<
2019-01-22 20:15:37
108
原创 AC自动机模板 hdu2222
题目链接#include<stdio.h>#include<iostream>#include<algorithm>#include<math.h>#include<new>#include<queue>#include<string.h>using namespace std;const int
2019-01-22 16:14:36
173
转载 Colourful Rectangle
题目链接#include<stdio.h>#include<iostream>#include<algorithm>#include<string.h>#include<queue>#include<vector>#include<map>using namespace std;const int
2019-01-21 16:01:15
183
原创 扫描线
Hdu1542 Atlantis题目大意:给你每个矩形的顶点坐标,让你求出这些矩形所覆盖的面积。刚开始看到这个题的时候,我也不知道怎么做,于是就看了下其他人的博客,自己也看了好久才大概明白了一点。#include<stdio.h>#include<iostream>#include<algorithm>#include<string.h&g...
2019-01-20 14:37:55
87
原创 Mondriaan's Dream状压dp
题目链接这是一道让你在nm的矩形中用12的长方形填满的方法种类数首先如果长方形横着摆放那么在横向上就要占据两个位置且用1,1表示状态。如果是竖着摆放,那么这个位置用0表示的话,那么就表示是与下面一行竖着摆放的,且下面的这个位置用1表示;如果这个位置用1表示的话,那么表示是与上面一行竖着摆放的,且上面的那个位置用0表示。#include<stdio.h>#include<s...
2019-01-08 14:07:23
167
原创 炮兵阵地 状压dp
题目链接//dp[x][y][z]:x表示当前的一行,y表示当前行的状态,z表示当前行的上一行状态#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>using namespace std;int dp[110][100][100],num[10...
2019-01-08 09:53:41
221
原创 数位dp HDU - 3652 B-number
题意:一个wqb数字或简称B数字是一个非负整数,其十进制形式包含子串“13”,并且可以除以13.例如,130和2613是wqb数字,但是143和 2639不是。 您的任务是计算给定整数n中从1到n有多少个wqb数字。这道题要用三维来进行处理dp[len][v13][num];len表示当前数字的位数,v13的值位0,1,2;0表示当前位的数字不是1;1表示当前位的数字为1;2表示这串数字中出现了每...
2019-01-07 15:10:35
178
原创 Computer 求树的直径hdu2196
#include&amp;lt;stdio.h&amp;gt;#include&amp;lt;iostream&amp;gt;#include&amp;lt;string.h&amp;gt;#include&amp;lt;algorithm&amp;gt;using namespace std;const int sz=10004;int vis[sz],d
2019-01-07 14:00:53
168
原创 树形dp Apple Tree
题目链接#include<stdio.h>#include<iostream>#include<string.h>#include<algorithm>using namespace std;int vis[300],dp[300][300][3],val[300],head[300];int n,k,cnt;struct node...
2019-01-07 10:41:30
146
原创 求树的直径
题目链接#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>using namespace std;const int sz=1e5+3;int vis[sz],dis[sz],head[sz];struct node{ int v,...
2019-01-07 08:49:22
141
原创 树形dp hdu1520
题目链接#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>#include<vector>using namespace std;vector<int>v[6600];int dp[6600][2],in[6600],...
2019-01-05 17:19:14
145
1
原创 树形dphdu1561
题目链接#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>#include<vector>using namespace std;vector<int>v[300];int vis[300],dp[300][300],...
2019-01-05 14:02:47
95
原创 树形dp入门
题目链接#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>#include<vector>using namespace std;vector<int>v[300];int vis[300],dp[300][300],...
2019-01-05 12:19:07
149
转载 种类并查集
A Bug’s Life题目链接#include<stdio.h>#define max 2200int pre[max],rank[max];int find(int x){ if(x!=pre[x]) { int px=find(pre[x]); rank[x]=(rank[x]+rank[pre[x]])%2; ...
2018-12-18 00:12:44
264
转载 概率dp
题目链接#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>#include<vector>#include<queue>#include<math.h>using namespace std;typede
2018-12-10 19:49:25
68
原创 数论 卡特兰数模板
Saving Beans题目链接#include<stdio.h>#include<string.h>#include<iostream>#include<algorithm>#include<vector>#include<queue>#include<math.h>using namespac
2018-12-10 19:12:42
148
转载 数位dp模板
hdu2089 不要62题目连接#include<stdio.h>int digit[22],dp[22][2]={0};int dfs(int len,bool if6,bool limit){ if(len==0)return 1; if(!limit&&dp[len][if6])return dp[len][if6]; int c...
2018-12-10 09:42:36
87
原创 Codeforces Round #523 (Div. 2)C. Multiplicity
C. Multiplicity题目连接You are given an integer array a1,a2,…,an.The array bis called to be a subsequence of a if it is possible to remove some elements from a to get b.Array b1,b2,…,bkis called t...
2018-12-04 17:14:47
198
原创 C. Books Queries
C. Books Querieshttp://codeforces.com/problemset/problem/1066/CYou have got a shelf and want to put some books on it.You are given qqueries of three types:L id— put a book having index idon the...
2018-12-04 14:50:58
352
原创 C. Meme Problem
题目连接C. Meme Problemtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputTry guessing the statement from this picture:You are given a non-nega...
2018-12-04 00:38:13
219
转载 C. George and Job
C. George and Job题目连接这是一道二维的dp。题目的大致意思为给你n个数,每一段有m个数,取k段,并且每一段区间没有交叉。数据类型要用long long。用sum数组记录前缀和,dp[i][]j]中i表示到第i个数时取了j段区间的最大和。dp[i][j]可以由dp[i-1][j]没有添加区间得到,也可以由dp[i-m][j-1]添加了一段区间得到。所以得到的状态转移方程为...
2018-12-04 00:02:14
350
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人