ACM ICPC 2015 Moscow Subregional Russia, Moscow, Dolgoprudny, October, 18, 2015 I. Illegal or Not?
1 second
512 megabytes
standard input
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.
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 "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.
1
2 91
Yes
1
1 91
No
2
3 91
180 200
No
2
181 270
1 90
Yes
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?的更多相关文章
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 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 ...
- 2015 ACM / ICPC 亚洲区域赛总结(长春站&北京站)
队名:Unlimited Code Works(无尽编码) 队员:Wu.Wang.Zhou 先说一下队伍:Wu是大三学长:Wang高中noip省一:我最渣,去年来大学开始学的a+b,参加今年区域赛之 ...
- Moscow Subregional 2013. 部分题题解 (6/12)
Moscow Subregional 2013. 比赛连接 http://opentrains.snarknews.info/~ejudge/team.cgi?contest_id=006570 总叙 ...
随机推荐
- 数据库TSQL语句
一.创建数据库create database test3;二.删除数据库drop database test3;三.如何创建表create(创建) table(表) test(表名)(此处写列 var ...
- 1.1-java创建包和类的方法
1.new-package-命名方法com打头.中间名称.后台要创建的class 2.创建class- new-class 选择一下主方法 代码示例 编译完保存一下就能输出信息,一直没有保存才 ...
- EasyUi–7.tab和datagrid和iframe的问题
1. 多个tab切换,第2个不显示 动态添加tab Iframe页面的方法 展开 折叠 <script type="text/javascript"> $(functi ...
- 对Object类中方法的深入理解
看一下API中关于Object的介绍: 类 Object 是类层次结构的根类.每个类都使用 Object 作为超类.所有对象(包括数组)都实现这个类的方法. 那么Object中到底有哪些方法,各自有什 ...
- Delphi的文件操作
参考自:http://www.cnblogs.com/railgunman/articles/1800318.html Delphi 中默认有input 和 output 两个文件变量,使用可以不用定 ...
- 【JAVA 文件概述】
一.概述 使用此类的原因: 该类将文件或者文件夹封装成对象.方便对文件与文件夹的属性信息进行操作.File对象作为参数传递给流的构造函数.要求:使用File类的常用方法. windows平台下,目录分 ...
- scrollTop和scrollLeft的兼容解决万全方法
1.各浏览器下 scrollTop的差异 IE6/7/8: 对于没有doctype声明的页面里可以使用 document.body.scrollTop 来获取 scrollTop高度 : 对于有do ...
- [LeetCode] Remove Duplicates from Sorted List
Given a sorted linked list, delete all duplicates such that each element appear only once. For examp ...
- jquery判断当前设备是手机还是电脑并跳转
<script type="text/javascript"> var commonURL = 'http://xxxx.com/'; function mobile_ ...
- ASP.NET 5探险(6):升级ASP.NET 5到beta6
(此文章同时发表在本人微信公众号"dotNET每日精华文章",欢迎右边二维码来关注.) 题记:微软根据ASP.NET 5的路线图如期发布了beta6,现在我们就来说说beta5升级 ...