题目链接:http://codeforces.com/problemset/problem/479/C

题目意思:简单来说,就是有个人需要通过 n 门考试,每场考试他可以选择ai, bi 这其中一个时间来考,要求 n 门考试过后,他所选择的时间序列是一条非递减序列,输出最少时间。

其实那个最少时间是骗人的,感觉没什么用。直接排序,然后每门课程选择尽可能少的时间来考,但这个时间需要满足 >= 前一门课程的时间。

感觉这道题比 B 题还要简单,额。。。是错觉了么,不过它题目意思确实有点绕~~~~纸老虎题,把握关键的一些信息即可做出。

#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include <algorithm>
using namespace std; #define f first
#define s second
const int maxn = + ;
pair<int, int> p[maxn]; int main()
{
int n;
while (scanf("%d", &n) != EOF)
{
for (int i = ; i < n; i++)
{
scanf("%d", &p[i].f);
scanf("%d", &p[i].s);
}
sort(p, p+n);
int pre = min(p[].f, p[].s); // 前一场考试的时间 for (int i = ; i < n; i++)
{
int tmp = min(p[i].f, p[i].s);
pre = (tmp < pre ? max(p[i].f, p[i].s) : tmp);
}
printf("%d\n", pre);
}
return ;
}

codeforces 479C Exams 解题报告的更多相关文章

  1. codeforces 492C. Vanya and Exams 解题报告

    题目链接:http://codeforces.com/problemset/problem/492/C 题目意思:给出 3 个整数:n,  r,  avg.然后有 n 行,每行有两个数:第 i 行有 ...

  2. codeforces 31C Schedule 解题报告

    题目链接:http://codeforces.com/problemset/problem/31/C 题目意思:给出 n 个 lessons 你,每个lesson 有对应的 起始和结束时间.问通过删除 ...

  3. codeforces 499B.Lecture 解题报告

    题目链接:http://codeforces.com/problemset/problem/499/B 题目意思:给出两种语言下 m 个单词表(word1, word2)的一一对应,以及 profes ...

  4. codeforces 495C. Treasure 解题报告

    题目链接:http://codeforces.com/problemset/problem/495/C 题目意思:给出一串只有三种字符( ')','(' 和 '#')组成的字符串,每个位置的这个字符 ...

  5. codeforces 490B.Queue 解题报告

    题目链接:http://codeforces.com/problemset/problem/490/B 题目意思:给出每个人 i 站在他前面的人的编号 ai 和后面的人的编号 bi.注意,排在第一个位 ...

  6. CodeForces 166E -Tetrahedron解题报告

    这是本人写的第一次博客,学了半年的基础C语言,初学算法,若有错误还请指正. 题目链接:http://codeforces.com/contest/166/problem/E E. Tetrahedro ...

  7. codeforces 489A.SwapSort 解题报告

    题目链接:http://codeforces.com/problemset/problem/489/A 题目意思:给出一个 n 个无序的序列,问能通过两两交换,需要多少次使得整个序列最终呈现非递减形式 ...

  8. codeforces 485A.Factory 解题报告

    题目链接:http://codeforces.com/problemset/problem/485/A 题目意思:给出 a 和 m,a 表示第一日的details,要求该日结束时要多生产 a mod ...

  9. codeforces 483A. Counterexample 解题报告

    题目链接:http://codeforces.com/problemset/problem/483/A 题目意思:给出一个区间 [l, r],要从中找出a, b, c,需要满足 a, b 互质,b, ...

随机推荐

  1. Oracle之自定义函数

    数据库中函数包含四个部分:声明.返回值.函数体和异常处理. --没有参数的函数 create or replace function get_user return varchar2 is v_use ...

  2. BZOJ-1834 网络扩容 最小费用最大流+最大流+乱搞

    1834: [ZJOI2010]network 网络扩容 Time Limit: 3 Sec Memory Limit: 64 MB Submit: 2269 Solved: 1136 [Submit ...

  3. You've got to find what you love

    你必须找到你爱的东西 You've got to find what you love 史蒂夫乔布斯2005年6月在斯坦福大学毕业典礼上的演讲 I am honored to be with you ...

  4. Opencv不用每次创建项目配置vs2010 vc++目录 库目录等项

    可以设置成编译器的环境配置,VS2010相对其他版本虽然去掉了编译器配置 但可以通过属性管理器配置编译器环境. 设置对应的vc++目录 链接器就可以了,这样就是对整个编译器配置了 下次就不用再配了.

  5. 本地与在线图片转Base64及图片预览

    查看效果:http://sandbox.runjs.cn/show/tgvbo9nq 本地图片转Base64(从而可以预览图片): function localImgLoad() { var src ...

  6. iOS @try @catch简单应用举例

  7. MIM协议与Base64编码

    MIME Protocol 1. MIME的全称是"Multipurpose Internet Mail Extensions",中译为"多用途互联网邮件扩展" ...

  8. 编写自己的Acunetix WVS漏洞扫描脚本详细教程

    AWVS提供了自定义的脚本编程接口,可是网上的资料很少,只有官方的几篇介绍和参考手册,最近研究了一下怎么编写AWVS的漏洞脚本来写一篇简单性的文章 本文以8.0为例,首先呢安装好Acunetix We ...

  9. 详细解析Java中抽象类和接口的区别

    在Java语言中, abstract class 和interface 是支持抽象类定 义的两种机制.正是由于这两种机制的存在,才赋予了Java强大的 面向对象能力.abstract class和in ...

  10. Visual Studio Online Integrations-Customer support

    原文:http://www.visualstudio.com/zh-cn/explore/vso-integrations-directory-vs