CF721C. Journey】的更多相关文章

CF721C Journey 给出一个\(n\)个点\(m\)条边的有向无环图. 问从\(1\)到\(n\),在距离不超过\(k\)的情况下最多经过多少点,并输出一个方案. \(topo\)+\(DP\). 记录路径的话,记一个前驱就行了. code: #include <iostream> #include <cstdio> #include <cstring> #include <queue> using namespace std; const int…
C. Journey time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Recently Irina arrived to one of the most famous cities of Berland — the Berlatov city. There are n showplaces in the city, numbe…
传送门 说实话,这是一道非常简单的DP题,简单到如果放到NOIp第二题可能都有些差强人意,然而我写崩了. 所以简单记录一下. 需要注意的是,这道题的DP应该是从$N$点开始,以1为边界,满足最短路的三角形性质即可转移. //cf c //by Cydiater //2016.9.30 #include <iostream> #include <cstdio> #include <cstring> #include <string> #include <…
题意:给一个无环的图,问用不超过T的时间从1到n最多可以经过多少个点.要求输出一条路径. 思路:因为无环,可以用DP做.不过因为时间最短的原因要拓扑排序后再DP,目测由底向上的更新也是可以的. ; ..,..]of longint; head,vet,next,len,flag,d,q,b:..]of longint; n,m,tot,i,j,time,k,x,y,z,ans:longint; procedure add(a,b,c:longint); begin inc(tot); next[…
A Knight's Journey Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 41936   Accepted: 14269 Description Background The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey ar…
1.CF #374 (Div. 2)    C.  Journey 2.总结:好题,这一道题,WA,MLE,TLE,RE,各种姿势都来了一遍.. 3.题意:有向无环图,找出第1个点到第n个点的一条路径,经过的点数要最多. #include<bits/stdc++.h> #define F(i,a,b) for (int i=a;i<b;i++) #define FF(i,a,b) for (int i=a;i<=b;i++) #define mes(a,b) memset(a,b,…
题目链接:http://poj.org/problem?id=2488 A Knight's Journey Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 36695   Accepted: 12462 Description Background The knight is getting bored of seeing the same black and white squares again and again…
题目链接: C. Journey time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Recently Irina arrived to one of the most famous cities of Berland — the Berlatov city. There are n showplaces in the city,…
A Knight's Journey Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 35564 Accepted: 12119 Description Background The knight is getting bored of seeing the same black and white squares again and again and has decided to make a journey around…
A Knight's Journey Time Limit : 2000/1000ms (Java/Other)   Memory Limit : 131072/65536K (Java/Other) Total Submission(s) : 51   Accepted Submission(s) : 17 Problem Description Background The knight is getting bored of seeing the same black and white…