题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5922 题意: 给出 $N$ 个冰淇淋球,第 $i$ 个冰淇淋球大小为 $B_i$,现在已知冰淇淋球堆叠起来可组成一个冰淇淋. 对于上下相邻的两个冰淇淋球,只有上面的那个大小不…
/** 题目:2016-2017 ACM-ICPC CHINA-Final Ice Cream Tower 链接:http://codeforces.com/gym/101194 题意:给n个木块,堆一个小塔要k个木块,满足相邻两个木块,上面的木块大小至少是下面的木块的两倍. 问最多可以堆出几个小塔. 思路:二分+贪心. 先二分最终可以堆出的小塔数x,然后确定了数量,就可以这样来贪心,把前x个木块作为所有小塔的顶部木块, 然后从剩下的木块中继续取前x小的,从小到大放在x个小塔的次顶部,然后继续.…
题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5923 题意: 现有 $N$ 支队伍参加比赛,只有一个队伍能获胜.给出每个队伍一个赔率 $A_i:B_i$,你往这个队投 $x$ 元,若该队获胜你可得到 $\frac{A_i+…
题目大意: 对于给出的n个冰激凌球的大小,满足下面的球的大小是上一个的至少2倍,对于给出的k(由k的冰激凌球才能算作一个冰激凌塔),问n个冰激凌球可以最多堆出多少个高度为k的冰激凌塔 题目分析: 对于n个冰激凌球,显然我们得知可以堆出的高度为k的塔的数量在0~[n / k]之间,这里可以通过二分遍历每一种可能,初始时二分边界l==0,r==[n / k],每次取中间值mid=(l+r)/ 2,判断mid高度为k的塔能否堆出,如果可以则尝试mid为更大,否则则尝试mid为更小时,不断二分尝试mid…
题目: Mr. Panda likes ice cream very much especially the ice cream tower. An ice cream tower consists of K ice cream balls stacking up as a tower. In order to make the tower stable, the lower ice cream ball should be at least twice as large as the ball…
2017-08-18 21:53:38 writer:pprp 题意如下: Problem D. Ice Cream Tower Input file: Standard Input Output file: Standard Ouptut Time limit: seconds Mr. Panda likes ice cream very much especially the ice cream tower. An ice cream tower consists of K ice crea…
被一道数位DP折磨得欲仙欲死之后,再做这道题真是如同吃了ice cream一样舒畅啊 #include<bits/stdc++.h> using namespace std; #define rep(i,a,b) for(int i=a;i<=b;++i) #define ms(arr,a) memset(arr,a,sizeof arr) #define debug(x) cout<<"< "#x" = "<<x&l…
题目链接 : https://cn.vjudge.net/problem/Gym-101194D 题目大意 : 给你n个冰激凌球,让你用这些冰激凌球去垒冰激凌,要求是下面的这一个必须是他上面一个的两倍大,一个冰激凌需要m个冰激凌,问你最多能造几个冰激凌. 具体思路: 贪心 + 二分 ,首先对输入的n个冰激凌球进行排序,从小到大开始,然后对答案进行二分,从当前的开始,找第一个满足的,然后找完一个再继续找下一个,如果当前要检测的答案是k,那么就需要找k层满足情况的. AC代码: #include<b…
题解:二分加贪心,,,二分答案,然后进行判断,判断的时候,首先给每一组配一个最大的球,然后在向每一组里面填球,注意填球的时候要按组进行,每一组先填一个,然后更新每一组内的最小值,方便下一次寻找. #include<bits/stdc++.h> using namespace std; typedef long long ll; ; ll arr[N]; ll b[N]; bool mark[N]; int n,m; bool judge(int x){ ; ;i<=x;i++) b[i]…
题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5921 题意: 一个长度为 $N$ 的序列,要求选出两段不重叠的区间,要求两个区间包含的元素均互不相同,求两段区间的长度和最大为多少. 题解: (主要参考https://blo…
题目链接: http://codeforces.com/gym/101194/attachments https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&problem=5926 题意: 给出 $N$ 行 $M$ 列的网格,每个格子内可以填入 $[1,K]$ 内的任意整数. 如果某个格子,它是它所在行上严格最大的,同时也是所在列上严格最大的,则认…
ZSoft Corp. is a software company in GaoKe Hall. And the workers in the hall are very hard-working. But the elevator in that hall always drives them crazy. Why? Because there is only one elevator in GaoKe Hall, while there are hundreds of companies i…
题意:你有b元钱,有n个配件,每个配件有各类,品质因子,价格,要每种买一个,让最差的品质因子尽量大. 析:很简单的一个二分题,二分品质因子即可,每次计算要花的钱的多少,每次尽量买便宜且大的品质因子. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000") #include <cstdio> #include <string> #include <cstdlib> #include &…
题目链接:https://codeforces.com/gym/102056/problem/L LCR is really an incredible being. Thinking so, sitting on the plane and looking at the sea, Rikka savours the fantastic journey. A fire never happened. It must be interesting to share it with her mate…
题目: To encourage visitors active movement among the attractions, a circular path with ice cream stands was built in the park some time ago. A discount system common for all stands was also introduced. When a customer buys ice cream at some stand, he…
传送门 Ice Cream Parlor Authored by dheeraj on Mar 21 2013 Problem Statement Sunny and Johnny together have M dollars they want to spend on ice cream. The parlor offers N flavors, and they want to choose two flavors so that they end up spending the whol…
Intervals 题目连接: http://codeforces.com/gym/100231/attachments Description 给你n个区间,告诉你每个区间内都有ci个数 然后你需要找一个最小的点集,使得满足这n个区间的条件 Input n 然后li,ri,ci Output 输出最小点集大小 Sample Input 5 3 7 3 8 10 3 6 8 1 1 3 1 10 11 1 Sample Output 6 Hint 题意 题解: 线段树+二分+贪心 首先我们贪心一…
ShareThis - By Vikas Verma Bluetooth low energy (BLE) is a feature of Bluetooth 4.0 wireless radio technology, aimed at new, principally low-power and low-latency, applications for wireless devices within a short range. As I discussed in my previous…
A. Free Ice Cream 题目连接: http://www.codeforces.com/contest/686/problem/A Description After their adventure with the magic mirror Kay and Gerda have returned home and sometimes give free ice cream to kids in the summer. At the start of the day they hav…
E. Sonya and Ice Cream time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Sonya likes ice cream very much. She eats it even during programming competitions. That is why the girl decided that…
Sunny and Johnny together have M dollars which they intend to use at the ice cream parlour. Among N flavors available, they have to choose two distinct flavors whose cost equals M. Given a list of cost of N flavors, output the indices of two items wh…
传送门 分析 这道题做了好长时间,题意就很难理解. 我们注意到这句话Vertices which have the i-th (1 ≤ i ≤ m) type of ice cream form a connected subgraph 也就是说在最后的图中相同颜色的点构成一个连通图 也就是说如果1和2.3在不同的点共同出现,那么2和3一定不会在某个点共同出现.于是我们可以直接暴力dfs,在每个点对没有颜色的冰激凌贪心染最小的颜色. 需要注意有某种冰激凌没有出现的情况. trick 代码 #in…
http://codeforces.com/contest/805/problem/E [题意] 染色数是很好确定,最少染色数是max(si)(最小为1,即使所有的si都为0,这样是单节点树形成的森林需要1种颜色),关键是确定染色方案. 一开始没看出来树有什么用,但其实一句话很关键:Vertices which have the i-th (1 ≤ i ≤ m) type of ice cream form a connected subgraph. 也就是说在原来的图中,含有相同的冰淇淋的点是…
题目链接: A. Free Ice Cream //#include <bits/stdc++.h> #include <vector> #include <iostream> #include <queue> #include <cmath> #include <map> #include <cstring> #include <algorithm> #include <cstdio> using…
Ice cream coloring 题解: 这个题目中最关键的一句话是, 把任意一种类型的冰激凌所在的所有节点拿下来之后,这些节点是一个连通图(树). 所以就不会存在多个set+起来之后是一个新的完全图. 所以只要直接去做就好了. 对于每个节点来说,染色. 代码: #include<bits/stdc++.h> using namespace std; #define Fopen freopen("_in.txt","r",stdin); freope…
题目链接:https://codeforces.com/gym/102056/problem/I Warm sunshine, cool wind and a fine day, while the girl watching is pursuing in chaos. Rikka reached out her hand and got the garland on her head, finding LCR with the immortal smile. The dream ended u…
题目描述 Farmer John为了保持奶牛们的健康,让可怜的奶牛们不停在牧场之间 的小路上奔跑.这些奶牛的路径集合可以被表示成一个点集和一些连接 两个顶点的双向路,使得每对点之间恰好有一条简单路径.简单的说来, 这些点的布局就是一棵树,且每条边等长,都为1. 对于给定的一个奶牛路径集合,精明的奶牛们会计算出任意点对路径的最大值, 我们称之为这个路径集合的直径.如果直径太大,奶牛们就会拒绝锻炼. Farmer John把每个点标记为1..V (2 <= V <= 100,000).为了获得更加…
D. Exams time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasiliy has an exam period which will continue for n days. He has to pass exams on m subjects. Subjects are numbered from 1 to m. Ab…
思路:二分+贪心 提交次数:10次以上 错因:刚开始以为二分(边界,$+1or-1$)写错了,调了半天,后来才发现是$ck()$写错了.开始只判了最后是否小于零,而应该中间一旦小于零就$return\space false$ 题解: 二分天数(单调性显然). $ck(int x)$: 首先$x$天内必须包含所有科目:然后贪心的考每一科的最后一次试(倒着扫一遍):维护一个剩余天数$cnt$,遇到空闲时间或不是最后本科目的一次考试就$++$,否则$-=$本科考试所需的复习天数:一旦$cnt<0$,直…
正解:二分/贪心 解题报告: 传送门$QwQ$ 首先这里是二分还是蛮显然的?考虑二分那个最大值,然后先保证一个老师是合法的再看另一个老师那里是否合法就成$QwQ$. 发现不太会搞这个合不合法的所以咕了.$QAQ$. 然后还有一个很神的方法是直接贪心,大概港下$QwQ$. 先考虑如果只有一个宿管,显然能合法就尽量合法,设当前合法的房间数为$cnt$,就直接看$\sum_{j=1}^{i+d\cdot i}$和$(cnt+1)\cdot b$的关系就成.正确性十分显然?就对于不合法的房间,反正都不合…