Codeforces 350B Resort】的更多相关文章

题目链接:http://codeforces.com/problemset/problem/350/B 一开始想复杂了,建了张图,结果效率太低T了.其实用数组存可以了,结果发现的时候快没时间了,修改好前5分钟比赛就结束了,泪目... 题目大意:每个地点有用1表示旅馆,用0表示是山地.每个地点用一个数表示能从哪一个地点到达这里(单向).现在要求一条最长的路径,除了终点为旅馆外,前面的路径上都是山地.要求前面的路上不能有分岔路,即从该点出发只有一条可行路. 解题思路:开一个数组存到达该点的始发地,再…
B - Resort CodeForces - 350B B. Resort time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Valera's finally decided to go on holiday! He packed up and headed for a ski resort. Valera's fancied…
[链接] 我是链接,点我呀:) [题意] [题解] 我们可以把原图的边都反向一下. 然后以每个休息点作为起点,进行dfs. 每次在扩展节点y的时候,要求这个点y必须只有一个出度,然后就能走多远就走多远就ok了. 会发现每个休息点占据的那些链都是唯一的,所以其他的休息点在进行dfs的时候,不会重复走到其他休息点dfs过的点. 因此这样dfs的复杂度是O(N)的. 随便搞搞,更新一下最大值就ok了. [代码] #include <bits/stdc++.h> #define rep1(i,a,b)…
Resort Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Practice CodeForces 350B Description Valera's finally decided to go on holiday! He packed up and headed for a ski resort. Valera's fancied a ski trip b…
A - Jzzhu and Cities CodeForces - 449B 题意:n座城市,m条路,k条铁路啥的吧,然后要求最多能删多少条铁路保持1到$n$的最短路不变. 思路:因为铁路是从1出发的.所以能删的铁路有该铁路长度不等于1到该节点的最短路的,相等的时候,如果该节点的入度非1,也可以删去. #include <cstdio> #include <cstring> #include <algorithm> #include <vector> #in…
C. Captains Mode 题目连接: http://codeforces.com/contest/377/problem/C Description Kostya is a progamer specializing in the discipline of Dota 2. Valve Corporation, the developer of this game, has recently released a new patch which turned the balance of…
上一次我们拿学校的URP做了个小小的demo.... 其实我们还可以把每个学生的证件照爬下来做成一个证件照校花校草评比 另外也可以写一个物理实验自动选课... 但是出于多种原因,,还是绕开这些敏感话题.. 今天,我们来扒一下cf的题面! PS:本代码不是我原创 1. 必要的分析 1.1 页面的获取 一般情况CF的每一个 contest 是这样的: 对应的URL是:http://codeforces.com/contest/xxx 还有一个Complete problemset页面,它是这样的:…
http://codeforces.com/contest/738/problem/D Galya is playing one-dimensional Sea Battle on a 1 × n grid. In this game a ships are placed on the grid. Each of the ships consists of bconsecutive cells. No cell can be part of two ships, however, the shi…
http://codeforces.com/contest/738/problem/C Vasya is currently at a car rental service, and he wants to reach cinema. The film he has bought a ticket for starts in t minutes. There is a straight road of length s from the service to the cinema. Let's…
http://codeforces.com/contest/738/problem/A Polycarp has interviewed Oleg and has written the interview down without punctuation marks and spaces to save time. Thus, the interview is now a string s consisting of n lowercase English letters. There is…