Movie

Cloud and Miceren like watching movies.

Today, they want to choose some wonderful scenes from a movie. A movie has N scenes can be chosen, and each scene is associate with an interval [L, R]. L is the beginning time of the scene and R is the ending time. However, they can't choose two scenes which have overlapping intervals. (For example, scene with [1, 2] and scene with [2, 3], scene with [2, 5] and scene with[3, 4]).

Now, can you tell them if they can choose such three scenes that any pair of them do not overlap?

Since there are so many scenes that you can't get them in time, we will give you seven parameters N, L1, R1, a, b, c, d, and you can generate L1 ~ LN, R1 ~ RN by these parameters.

 
  给定一些区间,然后求是否存在三个互不覆盖的区间...
  直接贪心,找出一个右边界最左的,和一个左边界最右的
  再找是否存在一个区间能与这两个区间互不交叉
  
  然而当我乐呵呵地开了int64之后发现MLE了...
  
  然后想了半天...除了多次reset之外根本找不到不存l,r的方法啊...
  那就存吧..发现官方题解上说用unsigned int,自然溢出真好啊!本来还担心10位乘10位int64也会乘爆
  然后发现Pas里面还真有一个这样神奇的东西叫做longword...
  乐呵呵地交了一发发现WA掉了...
  机智地放弃了Pas..我相信一定是longword的自然溢出出现了问题
  然后用C++写..就陷入了漫长的RE...
  最后发现是变量开在了int main()里面...
  唔...
 
  1. #include<cstdio>
  2. #include<cstdlib>
  3. #include<cstring>
  4. const int maxn = ;
  5. unsigned int l[maxn],r[maxn];
  6. int main(){
  7. int test;
  8. scanf("%d",&test);
  9. while (test--){
  10. unsigned int n,a,b,c,d,tem;
  11. scanf("%d%d%d%d%d%d%d",&n,&l[],&r[],&a,&b,&c,&d);
  12. for (int i=;i<=n;i++) l[i]=l[i-]*a+b,r[i]=r[i-]*c+d;
  13. for (int i=;i<=n;i++) if (l[i]>r[i]){tem=l[i];l[i]=r[i];r[i]=tem;}
  14. unsigned int x=r[],y=l[];
  15. for (int i=;i<=n;i++){
  16. if (r[i]<x) x = r[i];
  17. if (l[i]>y) y = l[i];
  18. }
  19. int flag = ;
  20. for (int i=;i<=n;i++) if (l[i]>x&&r[i]<y) flag = ;
  21. if (flag) printf("YES\n");else printf("NO\n");
  22. }
  23. return ;
  24. }
 
  晚安
 
  05/.May

[HDU5214]Movie解题报告|小水题大智慧的更多相关文章

  1. hdu5007 小水题

    题意:       给你一个串,如果出现子串 "Apple", "iPhone", "iPod", "iPad"输出MA ...

  2. hdu 4540 威威猫系列故事——打地鼠 dp小水题

    威威猫系列故事——打地鼠 Time Limit: 300/100 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) Total ...

  3. hdu 4524 郑厂长系列故事——逃离迷宫 小水题

    郑厂长系列故事——逃离迷宫 Time Limit: 3000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others) To ...

  4. POJ 1013 小水题 暴力模拟

    Counterfeit Dollar Time Limit: 1000MS   Memory Limit: 10000K Total Submissions: 35774   Accepted: 11 ...

  5. Codeforces441A_Valera and Antique Items(水题)

    Valera and Antique Items time limit per test 1 second memory limit per test 256 megabytes input stan ...

  6. 2011 ACM-ICPC 成都赛区解题报告(转)

    2011 ACM-ICPC 成都赛区解题报告 首先对F题出了陈题表示万分抱歉,我们都没注意到在2009哈尔滨赛区曾出过一模一样的题.其他的话,这套题还是非常不错的,除C之外的9道题都有队伍AC,最终冠 ...

  7. Codeforces 524 解题报告

    打的很快乐的一次比赛hiahiahia, 才A掉4题rating就涨了100+ 距离比赛\(3\)天了, 由于博主实在太颓, 又补掉了\(E\)题, 到现在才发解题报告 A. 语法题, 读入输出就行了 ...

  8. LeetCode 2 Add Two Sum 解题报告

    LeetCode 2 Add Two Sum 解题报告 LeetCode第二题 Add Two Sum 首先我们看题目要求: You are given two linked lists repres ...

  9. UVa 272 Tex Quotes --- 水题

    题目大意:在TeX中,左引号是 ``,右引号是 ''.输入一篇包含双引号的文章,你的任务是把他转成TeX的格式 解题思路:水题,定义一个变量标记是左引号还是右引号即可 /* UVa 272 Tex Q ...

随机推荐

  1. 软工实践Alpha冲刺(2/10)

    队名:我头发呢队 组长博客 作业博客 杰(组长) 过去两天完成了哪些任务 查看了讯飞开放平台的sdk 查阅了Google Material Design 2的官方文档 接下来的计划 继续打磨UI界面: ...

  2. UVALive - 6872 Restaurant Ratings 数位dp

    题目链接: http://acm.hust.edu.cn/vjudge/problem/113727 Restaurant Ratings Time Limit: 3000MS 题意 给你一个长度为n ...

  3. Divide two integers without using multiplication, division and mod operator.

    描述 不能使用乘法.除法和取模(mod)等运算,除开两个数得到结果,如果内存溢出则返回Integer类型的最大值.解释一下就是:输入两个数,第一个数是被除数dividend,第二个是除数divisor ...

  4. Httpd主配置文件httpd.conf 详解

    Apache的主配置文件:/etc/httpd/conf/httpd.conf默认站点主目录:/var/www/html/Apache服务器的配置信息全部存储在主配置文件/etc/httpd/conf ...

  5. Android 布局方式学习

    一.LinearLayout线性布局: 线性布局是程序中最常见的一种布局方式,线性布局可以分为水平线性布局和垂直线性布局两种, 通过android:orientation属性可以设置线性布局的方向 1 ...

  6. SonarQube安装

    要求 至少1G以上内存,推荐为2G Java:Oracle JRE 7u75+,OpenJDK 7u75+ 数据库: Microsoft SQL Server 2008/2012/2014 MySQL ...

  7. Hessian矩阵【转】

    http://blog.sina.com.cn/s/blog_7e1ecaf30100wgfw.html 在数学中,海塞矩阵是一个自变量为向量的实值函数的二阶偏导数组成的方块矩阵,一元函数就是二阶导, ...

  8. P1291 [SHOI2002]百事世界杯之旅

    题目描述 “……在2002年6月之前购买的百事任何饮料的瓶盖上都会有一个百事球星的名字.只要凑齐所有百事球星的名字,就可参加百事世界杯之旅的抽奖活动,获得球星背包,随声听,更克赴日韩观看世界杯.还不赶 ...

  9. 【转】C# typeof()实例详解

    转自:http://www.cnblogs.com/lm3515/archive/2010/09/02/1815725.html typeof(C# 参考) 用于获取类型的 System.Type 对 ...

  10. [洛谷P3174][HAOI2009]毛毛虫

    题目大意:给一棵树,求其中最大的“毛毛虫”,毛毛虫的定义是一条链上分出几条边 题解:把每个点的权值定义为它的度数减一,跑带权直径即可,最后答案加二 卡点:无 C++ Code: #include &l ...