Codeforces Round #235 (Div. 2) B. Sereja and Contests
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std; int main(){
int x,k;
cin >> x >> k;
vector<bool> num(x+, false);
num[x] = true;
for(int i = ; i < k ; ++ i){
int index, num1,num2;
cin >> index;
if( index == ){
cin >> num1 >> num2;
num[num1]=num[num2] = true;
}else{
cin >> num1;
num[num1] = true;
}
} int maxNumber = count(num.begin()+,num.end(),false);
int minNumber = ;
for(int i = ; i < x; ++ i){
if(!num[i]&&!num[i+]){ minNumber++;++i;}
else if( !num[i] && num[i+]) minNumber++;
}
cout<< minNumber << " "<<maxNumber<<endl;
}
Codeforces Round #235 (Div. 2) B. Sereja and Contests的更多相关文章
- Codeforces Round #235 (Div. 2)
A. Vanya and Cards time limit per test 1 second memory limit per test 256 megabytes input standard i ...
- Codeforces Round #215 (Div. 2) B. Sereja and Suffixes map
B. Sereja and Suffixes Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset ...
- Codeforces Round #215 (Div. 1) B. Sereja ans Anagrams 匹配
B. Sereja ans Anagrams Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/problemset ...
- Codeforces Round #235 (Div. 2) D. Roman and Numbers(如压力dp)
Roman and Numbers time limit per test 4 seconds memory limit per test 512 megabytes input standard i ...
- Codeforces Round #223 (Div. 2) E. Sereja and Brackets 线段树区间合并
题目链接:http://codeforces.com/contest/381/problem/E E. Sereja and Brackets time limit per test 1 secon ...
- Codeforces Round #235 (Div. 2) D. Roman and Numbers 状压dp+数位dp
题目链接: http://codeforces.com/problemset/problem/401/D D. Roman and Numbers time limit per test4 secon ...
- Codeforces Round #235 (Div. 2) D. Roman and Numbers (数位dp、状态压缩)
D. Roman and Numbers time limit per test 4 seconds memory limit per test 512 megabytes input standar ...
- Codeforces Round #223 (Div. 2)--A. Sereja and Dima
Sereja and Dima time limit per test 1 second memory limit per test 256 megabytes input standard inpu ...
- Codeforces Round #215 (Div. 2) D. Sereja ans Anagrams
http://codeforces.com/contest/368/problem/D 题意:有a.b两个数组,a数组有n个数,b数组有m个数,现在给出一个p,要你找出所有的位置q,使得位置q q+ ...
随机推荐
- CLR via C#(13)-浅谈事件
提起事件,我们都不陌生,事件使类之间有了交互的能力.它是建立在委托基础上的.有了前面对委托的了解,相信读起事件来也不会太难了.关于事件,现成的好文章数不胜数,本不打算写了.不过问道有先后,各抒己见,也 ...
- 大话数据结构–1.基础知识+2.算法
2.算法: 算法是解决特定问题求解步骤的描述,在计算机中表现为指令的有限序列,并且每个指令表现为一个或多个操作. 特性:输入.输出.有穷性.确定性.可行性. 2.9.1.算法时间复杂度: 语句 ...
- OID View
http://oid-info.com/get/1.3.6.1.2.1.17.1.4.1.2
- RabbitMQ驱动简单例子
using RabbitMQ.Client; using RabbitMQ.Client.Events; using System; using System.Collections.Generic; ...
- hdu 1075:What Are You Talking About(字典树,经典题,字典翻译)
What Are You Talking About Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 102400/204800 K ...
- 使用pl/sql監控PROCEDURE執行時間
創建表 CREATE TABLE PROCESS_TIMING_LOG ( PROCESS_NAME VARCHAR2(50 BYTE), EXECUTION_DATE D ...
- 单图上传预览(uploadpreview )
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Thinkphp 解决写入配置文件的方法
在/Application/Common/Common创建function.php,然后添加以下代码: <?php /** * [writeArr 写入配置文件方法] * @param [typ ...
- [Surface] 在win8.1上使用QQ截图放大问题(解决办法)
在使用每次截图的时候整个都被放大了,很让人郁闷,截不到完整的图,本着遇到问题解决问题的想法,这事早解决早好. 开工: 1. 度娘上搜索"win8 qq截图 放大",找到很多资料 ...
- 【使用Unity开发Windows Phone上的2D游戏】(1)千里之行始于足下
写在前面的 其实这个名字起得不太欠当,Unity本身是很强大的工具,可以部署到很多个平台,而不仅仅是可以开发Windows Phone上的游戏. 只不过本人是Windows Phone 应用开发出身, ...