Description In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and yif and onl…
14号就ccpc全国赛的全国赛了 而且也快东北赛的选拔赛了 现在队伍实力实在不行 参加了也是边缘化的队伍 虽然有新生保护的设置 但实话说 机会还是不大 所以不如趁现在开始好好努力 明年也许还有机会 An Ac a Day ( of course not keep a girl away ^_^ ) 题意呢 一个人开火车 一个人开大巴 火车走铁路 大巴走公路 现在有n个城镇 每两个城镇之间都有路 其中m条铁路 其他的都是公路 要求两个人都从1开始走 途中不相遇 问最快要多久 题面比较诡异 两个人…
codeforces 689 Mike and Shortcuts(最短路) 原题 任意两点的距离是序号差,那么相邻点之间建边即可,同时加上题目提供的边 跑一遍dijkstra可得1点到每个点的最短路,时间复杂度是O(mlogm) #include <cstdio> #include <iostream> #include <cstring> #include <queue> #include <vector> using namespace s…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple road network - for each…
A. The Two Routes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In Absurdistan, there are n towns (numbered 1 through n) and m bidirectional railways. There is also an absurdly simple ro…
题目链接:http://codeforces.com/problemset/problem/601/A 题目大意是有铁路和陆路两种路,而且两种方式走的交通工具不能在中途相遇. 此外,有铁路的地方肯定没有陆路. 这种情况下就会有一个结论,就是至少有一种交通可以直接1到n. 这样只需要对另一种跑一个最短路就OK了. 代码: #include <iostream> #include <cstdio> #include <cstdlib> #include <cmath&…
Description through n) and m bidirectional railways. There is also an absurdly simple road network — for each pair of different towns x and y, there is a bidirectional road between towns x and yif and only if there is no railway between them. Travell…
E. Paths and Trees time limit per test: 3 seconds memory limit per test: 256 megabytes input: standard input output: standard output Little girl Susie accidentally found her elder brother's notebook. She has many things to do, more important than sol…
原题链接:http://codeforces.com/gym/100338/attachments/download/2136/20062007-winter-petrozavodsk-camp-andrew-stankevich-contest-22-asc-22-en.pdf 题意 给你一个无向图,要从1走到n,问你哪些边去掉之后就没法走原本的最短路了. 题解 跑两发最短路,顺着跑一发,倒着跑一发,对于边(u,v),如果w(u,v)+d[u]+rd[v]或者w(u,v)+d[v]+rd[u]…
https://codeforces.com/contest/59/problem/E 原来以为不会..看了题解发现貌似自己其实是会的? 就是拆点最短路..拆成n^2个点,每个点用(i,j)表示,表示这样的状态:原图中当前在j,前一步在i 然后就跑bfs,两点(i1,j1),(i2,j2)之前有边,当且仅当j1=i2,且(i1,j1,j2)没有被ban掉,且原图中(i2,j2)间有边:用一些set之类的来存储某三元组是否被ban 复杂度好像不是很对?然而仔细想一下可以发现转移最多总共只有O(nm…