#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的更多相关文章

  1. Codeforces Round #235 (Div. 2)

    A. Vanya and Cards time limit per test 1 second memory limit per test 256 megabytes input standard i ...

  2. 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 ...

  3. 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 ...

  4. 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 ...

  5. 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 ...

  6. 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 ...

  7. 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 ...

  8. 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 ...

  9. 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+ ...

随机推荐

  1. 【Jquery】【控件】flexigrid 自定义查询

    最近用flexigrid作报表,需要自定义条件进行查询,界面如下: 翻了半天文档也没找到如何用POST方法自行传递参数进行查询. 找了一个台湾人写的博客,却要改flexigrid的源代码,更不靠谱. ...

  2. Windows 10 周年更新正式版下载 + win10 快捷键

    Windows 10 周年更新正式版  360云资源总汇(施工中): https://yunpan.cn/c6Svi7Az52XBs (提取码:e5dd)今后提到周年更新版.1607版或RS1版,都是 ...

  3. JS手机浏览器判断(转)

    整理查询一下,js判断手机浏览器的方法 <script type="text/javascript"> /* * 智能机浏览器版本信息:包括微信内置 * */ var ...

  4. OCJP(1Z0-851) 模拟题分析(六)over

    Exam : 1Z0-851 Java Standard Edition 6 Programmer Certified Professional Exam 以下分析全都是我自己分析或者参考网上的,定有 ...

  5. [LeetCode] Largest Rectangle in Histogram

    Given n non-negative integers representing the histogram's bar height where the width of each bar is ...

  6. Codeforces Round #364 As Fast As Possible

    二分思想,对所要花费的时间进行二分,再以模拟的形式进行验证是否可行. 使用二分法,可以将一个求最优解的问题转化为一个判定问题,优雅的暴力. #include<cstdio> #includ ...

  7. Metrics介绍

    Metrics可以为你的代码的运行提供无与伦比的洞察力.作为一款监控指标的度量类库,它提供了很多模块可以为第三方库或者应用提供辅助统计信息, 比如Jetty, Logback, Log4j, Apac ...

  8. [v9] 列表页 调用 正文内容 或 自定义 字段(moreinfo的调用方法)

    "才能使用的字段) id content readpoint groupids_view paginationtype maxcharperpage template paytype all ...

  9. 您的 PHP 似乎没有安装运行 WordPress 所必需的 MySQL 扩展”处理方法

    转自:http://www.xuebuyuan.com/1549022.html 这已经是一个老掉牙的问题了,部分人使用自己的服务器安装WordPress程序之后,会出现“您的 PHP 似乎没有安装运 ...

  10. Windows下MySQL zip版的简单安装

    1.下载MySQL-5.5.10-win32.zip的版本.2.解压到任意路径,比如"D:\Programm Files\".3.进入MySQL路径,复制my-small.ini为 ...