codeforces 665A Buses Between Cities】的更多相关文章

A. Buses Between Cities time limit per test: 1 second memory  limit per test: 256 megabytes input: standard input output: standard output Buses run between the cities A and B, the first one is at 05:00 AM and the last one departs not later than at 11…
简单题 #include<cstdio> #include<cstring> #include<cmath> #include<vector> #include<map> #include<stack> #include<queue> #include<string> #include<algorithm> using namespace std; int a,ta,b,tb; int hh,mm;…
题目链接: A. Buses Between Cities time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output   Buses run between the cities A and B, the first one is at 05:00 AM and the last one departs not later than at…
A. Buses Between Cities 题目连接: http://www.codeforces.com/contest/665/problem/A Description Buses run between the cities A and B, the first one is at 05:00 AM and the last one departs not later than at 11:59 PM. A bus from the city A departs every a mi…
题目描述: Jzzhu and Cities time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Jzzhu is the president of country A. There are n cities numbered from 1 to n in his country. City 1 is the capital of…
题意: 从A到B的汽车每隔 a 分钟发车一次,从A到B要ta分钟. 从B到A汽车每隔b分钟发车一次,从B到A要ta分钟. Simion从A出发,问他在A->B的途中共遇到了多少辆车. 汽车都是从上午5.00出发,最晚到晚上11.59. 思路: 这种CF题模拟模拟!!!讲道理模拟题的能力好弱啊!!! 直接就是从5:00到11:59模拟一发,然后中间只会有两种可能,一个是那个人还没出去之前,一个是那个人出去了以后,车子在路上. 然后就是纯模拟就可以了,但是模拟的条件,还是靠感觉写的好啊 #inclu…
Trucks and Cities 一个很显然的做法就是二分然后对于每个车贪心取check, 这肯定会TLE, 感觉会给人一种贪心去写的误导... 感觉有这个误导之后很难往dp那个方向靠.. dp[ k ][ i ][ j ]表示把 i, j 这个区间分成 k 段, 所有段的最大值的最小值为多少. 然后dp的过程中把车代进去求答案. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #…
[题目链接] https://codeforces.com/contest/449/problem/B [算法] 最短路 时间复杂度 : O(N ^ 2) [代码] #include<bits/stdc++.h> using namespace std; ; const int INF = 2e9; int n , m , k; int mark[MAXN]; long long dist[MAXN]; bool inq[MAXN]; vector< pair<int,int>…
输入一个无向图<V,E>    V<=1e5, E<=3e5 现在另外给k条边(u=1,v=s[k],w=y[k]) 问在不影响从结点1出发到所有结点的最短路的前提下,最多可以删除k条边的多少条 跑最短路的时候维护或者统计就好了 一开始用spfa.然后TLE 45...好久没写  Dij+堆优化   ... p.s.优先队列默认大顶堆 Dij+堆优化   264ms #include <cstdio> #include <cstring> #include…
#include<bits/stdc++.h> #define MAXN 100050 #define MAXM 900000 using namespace std; struct st { int id; long long dis; st(int a,long long b) { id=a; dis=b; } st(){}; }; struct edge{ bool im; int id; long long w; edge *next; }; edge *adj[MAXN]; edge…