I. Illegal or Not?
time limit per test

1 second

memory limit per test

512 megabytes

input

standard input

output

standard output

The Schengen Agreement was signed by a number of countries to uniform many visa-related questions and to allow tourists from outside of the Schengen area to enter and freely travel within Schengen member states using only one visa. A multiple-entry visa owner can perform many travels to any Schengen member state using a single visa, but migration laws limit the number of days he is allowed to stay there. For any consecutive 180 days a visa owner is only allowed to be inside the Schengen area for no more than 90 days in total.

A tourist has got his 5-year Schengen multiple-entry visa on October 18th 2010, therefore he could travel to and from the Schengen area at any of 5·365 + 1 (2012 was a leap year)  = 1826 days.

Yesterday (October 17th, 2015) was the last day his visa was valid, and the tourist wants to know whether he has broken the migration laws and may face problems with obtaining a new Schengen visa. You are given the information about all trips to the Schengen member states he did using this visa and are to verify the rule about consecutive days for multiple-entry visa holders. According to the Schengen visa rules the day of arrival and the day of departure are considered to be days spent inside the Schengen area.

Input

The first line of the input contains only number of trips n (1 ≤ n ≤ 1826).

The i-th of the following n lines describes the i-th trip with two integers ai and di — the day of arrival to Schengen area and the day of departure respectively (1 ≤ ai ≤ di ≤ 1826). Days are numbered starting from the day the visa was issued.

It is guaranteed that these trips do not overlap, that is, each of 1826 days is a part of no more than one trip. Trips are given in arbitrary order.

Output

Output "Yes" (without quotes) if the tourist has followed the rules and may not worry about a new visa. Print "No" (without quotes) if he needs to start to look for an explanation to give to migration officer.

Sample test(s)
input
1
2 91
output
Yes
input
1
1 91
output
No
input
2
3 91
180 200
output
No
input
2
181 270
1 90
output
Yes
Note

In the second sample the tourist was in Schengen area for 91 days in the 180-day window which starts on day 1.

In the third sample the tourist was in Schengen area for 91 days in the 180-day window which started on day 2 (89 days from day 3 to day 91 and 2 days from day 180 to day 181).

题意:给出N个区间,全部变为1,否则为0,问从1到1826范围内,是否有连续的一段(长度固定为180),含有1的部分的长度超过90(同一块不重复Count)

分析:暴力

 /**
Create By yzx - stupidboy
*/
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <cmath>
#include <deque>
#include <vector>
#include <queue>
#include <iostream>
#include <algorithm>
#include <map>
#include <set>
#include <ctime>
#include <iomanip>
using namespace std;
typedef long long LL;
typedef double DB;
#define MIT (2147483647)
#define INF (1000000001)
#define MLL (1000000000000000001LL)
#define sz(x) ((int) (x).size())
#define clr(x, y) memset(x, y, sizeof(x))
#define puf push_front
#define pub push_back
#define pof pop_front
#define pob pop_back
#define ft first
#define sd second
#define mk make_pair inline int Getint()
{
int Ret = ;
char Ch = ' ';
bool Flag = ;
while(!(Ch >= '' && Ch <= ''))
{
if(Ch == '-') Flag ^= ;
Ch = getchar();
}
while(Ch >= '' && Ch <= '')
{
Ret = Ret * + Ch - '';
Ch = getchar();
}
return Flag ? -Ret : Ret;
} const int N = ;
int n;
bool cnt[N]; inline void Input()
{
scanf("%d", &n);
for(int i = ; i < n; i++)
{
int l, r;
scanf("%d%d", &l, &r);
for(int j = l; j <= r; j++)
cnt[j] = ;
}
} inline void Solve()
{
for(int i = ; i <= ; i++)
for(int j = i, count = ; j < i + ; j++)
{
count += cnt[j];
if(count > )
{
printf("No\n");
return;
}
}
printf("Yes\n");
} int main()
{
Input();
Solve();
return ;
}

ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 I. Illegal or Not?的更多相关文章

  1. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 G. Garden Gathering

    Problem G. Garden Gathering Input file: standard input Output file: standard output Time limit: 3 se ...

  2. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 D. Delay Time

    Problem D. Delay Time Input file: standard input Output file: standard output Time limit: 1 second M ...

  3. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 K. King’s Rout

    K. King's Rout time limit per test 4 seconds memory limit per test 512 megabytes input standard inpu ...

  4. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 H. Hashing

    H. Hashing time limit per test 1 second memory limit per test 512 megabytes input standard input out ...

  5. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 C. Colder-Hotter

    C. Colder-Hotter time limit per test 1 second memory limit per test 512 megabytes input standard inp ...

  6. ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 A. Anagrams

    A. Anagrams time limit per test 1 second memory limit per test 512 megabytes input standard input ou ...

  7. hdu 5444 Elven Postman(二叉树)——2015 ACM/ICPC Asia Regional Changchun Online

    Problem Description Elves are very peculiar creatures. As we all know, they can live for a very long ...

  8. 2015 ACM / ICPC 亚洲区域赛总结(长春站&北京站)

    队名:Unlimited Code Works(无尽编码)  队员:Wu.Wang.Zhou 先说一下队伍:Wu是大三学长:Wang高中noip省一:我最渣,去年来大学开始学的a+b,参加今年区域赛之 ...

  9. Moscow Subregional 2013. 部分题题解 (6/12)

    Moscow Subregional 2013. 比赛连接 http://opentrains.snarknews.info/~ejudge/team.cgi?contest_id=006570 总叙 ...

随机推荐

  1. 解决eclipseMavne的web项目debug时没有源码

  2. 营业额统计(bzoj1588)

    Description 营业额统计 Tiger最近被公司升任为营业部经理,他上任后接受公司交给的第一项任务便是统计并分析公司成立以来的营业情况. Tiger拿出了公司的账本,账本上记录了公司成立以来每 ...

  3. CSS3与页面布局学习总结——Box Model、边距折叠、内联与块标签、CSSReset

    目录 一.盒子模型(Box Model) 1.1.宽度测试 1.2.溢出测试 1.3.box-sizing属性 1.4.利用CSS画图 二.边距折叠 2.1.概要 2.2.垂直方向外边距合并计算 三. ...

  4. hdu5878(枚举,打表)

    题目链接:hdu5878 题意:到一行输入t,表示下面有t组数据,然后下面t行每行输入一个数n; 定义x==2^a*3^b*5^c*7^d(a, b, c, d为自然数,x不大于1e+9): 要求对于 ...

  5. 与你相遇好幸运,Sails.js安装

    官网: http://sailsjs.org Github:https://github.com/balderdashy/sails 开发文档: http://sailsjs.org/document ...

  6. Spring Boot的快速启动和部署

    >>关于Spring Boot 这是官网描述的特点: 1.Create stand-alone Spring applications 创建独立的Spring应用 2.Embed Tomc ...

  7. win10下安装Ubuntu + 修复Ubuntu引导

    如何在已安装 Windows 10 的情况下安装 Linux(Ubuntu 15.04)双系统? - Microsoft Windows - 知乎http://www.zhihu.com/questi ...

  8. C++ 基础 构造函数的使用

  9. hdu 1851 尼姆+巴什博弈

    先在每堆中进行巴什博弈,然后尼姆 #include<stdio.h> int main() { int T; int i,n; int ans,m,l; scanf("%d&qu ...

  10. 谈谈网站插入youtube视频播放

    最近需要在网页首页追加视频播放功能. 需要播放youtube视频.中间遇到一些波折.特来分享一下. 首先像网页添加视频文件我们通常够采用embed标签. 标签里可以设置很多的关键子.我们可以配置为fl ...