06 2013 档案
摘要:这题的思想很简单,就是每次找出队列里面花费时间最少的来走下一步,这样当我们找到k点后,所花费的时间一定是最少的。但要用一个标记数组vis[200010],用来标记是否走过。否则会内存溢出。#include<queue>#include<cstdio>#include<iostream>#include<algorithm>using namespace std;int vis[200010];struct Point{ int position,Time; Point(int a,int b) { position=a;Time=b; vis[a
阅读全文
摘要:#include<cstdio>#include<iostream>#include<cstring>#include<algorithm>#define N 310#define M 50010#define inf 1<<30using namespace std;int dp[21][21][21];int main(){ int a,b,c,i,j; memset(dp,0,sizeof(dp)); for(i=0;i<=20;i++) for(j=0;j<=20;j++) { dp[0...
阅读全文
摘要:递归版sap:#include#include#include#include#define N 310#define M 50010#define inf 1=n)return flow-lv; if(lv==0) break; } if(d[v]#include#include#include#include#define Maxn 6010#define Maxm 200000#define LL __int64#define Abs(a) (a)>0?(a):(-a)using namespace std;str...
阅读全文
摘要:#include<iostream>#include<cstdio>#include<cstring>#include<algorithm>#include<cmath>#define N 10010using namespace std;int dep[N],farther[N],vi[N],sec[N],Md,index[N],e,set[N];struct Edge{ int to,next;}edge[N];void addedge(int from,int to){ edge[e].to=to; edge[e].next=i
阅读全文
摘要:此题的题意很明确,就是求最长公共子序列;#include<iostream>#include<algorithm>#include<cstdio>#include<cstring>#include<queue>using namespace std;int dp[2010][2010];int hash[255];int main(){ char str[2010],ter[2010],fir[2010]; int n,i,j; while(scanf("%d",&n)!=EOF) { memset(has
阅读全文

浙公网安备 33010602011771号