ural 2021 Scarily interesting!(贪心)】的更多相关文章

题意:给定两个队伍的每个人的得分,让你安排怎么比赛才能使得观众知道冠军的时间最长. 析:贪心,很简单,就是先开始总分高的先出最差劲的,总分低的先出最厉害的,这个题当时实在是读的不明白啊,WA了好多次. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include…
2021. Scarily interesting! Time limit: 1.0 secondMemory limit: 64 MB This year at Monsters University it is decided to arrange Scare Games. At the Games all campus gathers at the stadium stands, and the Scare program students divide into two teams to…
Scarily interesting! 题目链接: http://acm.hust.edu.cn/vjudge/contest/126546#problem/D Description This year at Monsters University it is decided to arrange Scare Games. At the Games all campus gathers at the stadium stands, and the Scare program students…
This year at Monsters University it is decided to arrange Scare Games. At the Games all campus gathers at the stadium stands, and the Scare program students divide into two teams to compete in their abilities of scaring children. This year the two te…
Problem This year at Monsters University it is decided to arrange Scare Games. At the Games all campus gathers at the stadium stands, and the Scare program students divide into two teams to compete in their abilities of scaring children. This year th…
链接: http://acm.timus.ru/problem.aspx?space=1&num=1303 按照贪心的思想,每次找到覆盖要求区间左端点时,右端点最大的线段,然后把要求覆盖的区间改为这个右端点到M这个区间.依次类推下去,这样的话就只需要扫一遍就可以找去来. 要做的预备工作就是将线段按照左端点的升序排序就可以了. 它的时间复杂度就是O(n) 代码一直WA,望大神指教 #include<iostream> #include<stdio.h> #include<…
Illegal spices 题目连接: http://acm.timus.ru/problem.aspx?space=1&num=1995 Description Jabba: Han, my boy, you disappoint me. Why haven't you paid me? And why did you fry poor Greedo? Han: Look, Jabba, next time you wanna talk to me, come see me yourself…
http://acm.timus.ru/problem.aspx?space=1&num=2070 题意:A认为如果某个数为质数的话,该数字是有趣的.B认为如果某个数它分解得到的因子数目是素数的话,那么该数字是有趣的. 现在问[L,R]里面有多少个数是同时满足这两个条件或者同时不满足这两个条件的数. 简化题意就是,用[L,R]里面的总数 - 是一个合数并且其因子数是素数的数目. 一开始想,如果是平方的话,那么因子数必定是一个奇数,但是奇数里面的素数要怎么找就不知道了.想到后面离正解越走越远. 正…
最近做的一场比赛,把自己负责过的题目记一下好了. Problem B URAL 2013 Neither shaken nor stirred 题意:一个有向图,每个结点一个非负值,可以转移到其他结点.初始时刻从结点出发,然后每次到达一个结点询问上一个到达的正值结点的权值,离开结点时也要询问一下,因为当前结点可能为正数,答案就是这个值了,如果不存在这个样的正权值输出“sober",或者不明确时输出“unkonwn”. 分析:可以当做树形dp来做.dp[u][0]表示进入结点时上一个正权值,dp[…
这一次都主要是贪心练习 练习地址http://acm.hust.edu.cn/vjudge/contest/view.action?cid=26733#overview Problem APOJ 1328 对于每一个点,可以找到他在x轴上的可行区域,这样的话就变为了对区间的贪心. #include<iostream> #include<stdio.h> #include<string.h> #include<map> #include<vector&g…