[CF] Final Exam Arrangement
#include<stdio.h>
#include<algorithm>
using namespace std;
const int maxn=; struct ST
{
int s;
int t;
int num;
int day;
}c[maxn]; bool cmp1(ST a,ST b)
{
if(a.s==b.s)
return a.t<b.t;
else
return a.s<b.s;
} bool cmp2(ST a,ST b)
{
if(a.day==b.day)
return a.num<b.num;
else
return a.day<b.day;
}
int main()
{
int n,i;
while(scanf("%d",&n)!=EOF)
{
for(i=;i<=n;i++)
{
scanf("%d%d",&c[i].s,&c[i].t);
c[i].num=i;
c[i].day=;
}
sort(c+,c+n+,cmp1); c[].day=;
for(i=;i<=n;i++)
{
if(c[i].s<c[i-].t)
{
c[i].day=c[i-].day;
c[i].s = max(c[i].s, c[i-].s);
c[i].t = min(c[i].t, c[i-].t);
}
else
c[i].day=c[i-].day+;
}
sort(c+,c+n+,cmp2);
printf("%d\n",c[n].day); printf("%d",c[].num);
for(i=;i<=n;i++)
{
if(c[i].day==c[i-].day)
printf(" %d",c[i].num);
else
printf("\n%d",c[i].num);
}
printf("\n");
}
return ;
}
[CF] Final Exam Arrangement的更多相关文章
- zoj 3721 Final Exam Arrangement【贪心】
题目:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3721 来源:http://acm.hust.edu.cn/vjudg ...
- Final Exam Arrangement(ZOJ)
In Zhejiang University, there are N different courses labeled from 1 to N. Each course has its own t ...
- ZOJ-3721 Final Exam Arrangement 贪心
题目链接:http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemCode=3721 容易的贪心题,排个序.. //STATUS:C++_AC_ ...
- HDU 6651 Final Exam (思维)
2019 杭电多校 7 1006 题目链接:HDU 6651 比赛链接:2019 Multi-University Training Contest 7 Problem Description Fin ...
- 2019 Multi-University Training Contest 7 Kejin Player Final Exam
Kejin Player 期望DP 题意: 初始等级为1,每一级有四个参数 r , s , x , a . 每一级有一个概率p=r/s花费a的代价升级到下一级,失败可能会倒退到x级 设从 l 到 r ...
- 2019HDU多校第七场 HDU6651 Final Exam
一.题目 Final Exam 二.分析 题目说的比较绕,总之一定要记住,$n$个题目都可以做,至少作对$k$到,但是做题目的人不知道每道题对应的分数. 作为出题人,如果他是田忌,肯定不会去在做题目的 ...
- 有感于Java Final Exam
秋季学期的java已经结课了,当看到教务平台贴出的通知说考试形式为单选题时,心中喜忧参半. 可喜的是这种考试形式还是比较得民心,毕竟除了判断题,最好做的也就是单选题了. 然而期中考试选择题50%的命中 ...
- HDU 6651 Final Exam
hdu题面 Time limit 2000 ms Memory limit 524288 kB OS Windows 吐槽 比赛时候晕死了-- 解题思路 先留坑 公式法 https://blog.cs ...
- Algorithm lesson final exam
1.algorithm analysis O B/W/AV/AMOR,混入其他问题,设计+分析 2.传统算法(肯定要考) 1)divide and conquer master therem. rec ...
随机推荐
- 201521123118《java与程序设计》第14周学习总结
1. 本周学习总结 1.1 以你喜欢的方式(思维导图或其他)归纳总结多数据库相关内容. 2. 书面作业 1. MySQL数据库基本操作 建立数据库,将自己的姓名.学号作为一条记录插入.(截图,需出现自 ...
- POJ-2299 Ultra-QuickSort (树状数组,离散化,C++)
Problem Description In this problem, you have to analyze a particular sorting algorithm. The algorit ...
- SSH第一篇【整合SSH步骤、OpenSessionInView】
前言 到目前为止,Struts2.Hibernate.Spring框架都过了一遍了.也写过了Spring怎么与Struts2整合,Spring与Hibernate整合-本博文主要讲解SSH的整合 整合 ...
- Jacoco远程统计tomcat服务(Windows系统)的代码覆盖率
Jacoco远程统计tomcat服务(Windows系统)的代码覆盖率 2017-09-21 目录 1 Jacoco的安装和设置 1.1 什么是Jacoco? 1.2 Jacoco安装 1.3 ...
- Bootstrap笔记合集
一. 为了简化操作,方便使用,Bootstrap通过定义四个类名来控制文本的对齐风格: ☑ .text-left:左对齐 ☑ .text-center:居中对齐 ☑ .text-right ...
- StringBuffer的添加与删除功能
StringBuffer的添加功能A* public StringBuffer append(String str): * 可以把任意类型数据添加到字符串缓冲区里面,并返回字符串缓冲区本身 B* pu ...
- Java线程池带图详解
线程池作为Java中一个重要的知识点,看了很多文章,在此以Java自带的线程池为例,记录分析一下.本文参考了Java并发编程:线程池的使用.Java线程池---addWorker方法解析.线程池.Th ...
- oracle pl/sql 简介
一.pl/sql 是什么pl/sql(procedural language/sql)是oracle在标准的sql语言上的扩展.pl/sql不仅允许嵌入sql语言,还可以定义变量和常量,允许使用条件语 ...
- 【专章】dp基础
知识储备:dp入门. 好了,完成了dp入门,我们可以做一些稍微不是那么裸的题了. ----------------------------------------------------------- ...
- HDU1698 线段树(区间更新区间查询)
In the game of DotA, Pudge's meat hook is actually the most horrible thing for most of the heroes. T ...