bzoj1620
来源:互联网 发布:seo服务cao4 编辑:程序博客网 时间:2024/06/04 00:09
分析:我tm在想啥呢。。怎么一上来就Dp,,这不是水的一匹的贪心么。。
#include<cstdio>#include<cstring>#include<algorithm>#define fo(i,a,b) for(int i=a;i<=b;i++)#define fd(i,a,b) for(int i=a;i>=b;i--)using namespace std;typedef long long ll;const int N=1e5+5;int n,m;int f[N];struct node{ int t,d;}a[N];bool cmp(node a,node b){ return a.d>b.d;}int main(){ scanf("%d",&n); fo(i,1,n)scanf("%d%d",&a[i].t,&a[i].d); sort(a+1,a+n+1,cmp); int ans=100000000; fo(i,1,n) ans=min(ans,a[i].d)-a[i].t; if (ans<0)printf("-1"); else printf("%d\n",ans); return 0;}
0 0
- bzoj1620
- bzoj1620 [Usaco2008 Nov]Time Management 时间管理
- [BZOJ1620][Usaco2008 Nov]Time Management 时间管理
- 【Usaco2008Nov】【BZOJ1620】Time Management 时间管理
- [BZOJ1620][Usaco2008 Nov]Time Management 时间管理
- bzoj1620【Usaco2008 Nov】Time Management 时间管理
- BZOJ1620: [Usaco2008 Nov]Time Management 时间管理
- 3-4 Python中什么是变量
- 使用for九九乘法表
- POJ 1496 Word Index (组合数学 求字符串对应编码)
- 如何更新 OpenStack 组件?- 每天5分钟玩转 OpenStack(161)
- 复习
- bzoj1620
- Problem H: 平面上的点和线——Point类、Line类 (IV)
- Hibernate查询语句HQL
- thinkphp网站提示缓存文件写入失败
- 关于Graphx中的pregel的API理解
- 【BZOJ 1058】【ZJOI 2007】报表统计【Treap】
- PHP小笔记
- 运动框架-----改变任意的style值
- win10系统安装VM、ubuntu及ubuntu自适应桌面