题解-CF436E Cardboard Box】的更多相关文章

题面 CF436E Cardboard Box \(n\) 个关卡,对每个关卡可以花 \(a_i\) 时间得到 \(1\) 颗星,或花 \(b_i\) 时间得到 \(2\) 颗星,或不玩.问获得 \(m\) 颗星最少需要多少时间. 数据范围:\(1\le n\le 3\cdot 10^5\),\(1\le m\le 2n\),\(a_i<b_i\). 题解 蒟蒻做这题时已经知道是反悔贪心了,但是做了 \(4\) 个小时做不出来.于是去看题解,感觉这个 \(5\) 堆做法太非人类了,于是去看 CF…
题意 有nnn个关卡,第iii关可以花费aia_iai​的代价打一颗星,bib_ibi​的代价打两颗星.保证1≤ai<bi≤1091\le a_i<b_i\le10^91≤ai​<bi​≤109,问要达到www颗星最少花费. 题解 就是 hdu6698.Coinshdu 6698.Coinshdu6698.Coins 的弱化版. hduhduhdu多校赛上是要查询要达到1→2n1\to 2n1→2n的所有每个www的答案. 先把bi减去ai得到新的bi,要获取第二颗星的代价就是新的bi.…
Cardboard Box 贪了个半天贪不对, 我发现我根本就不会贪心. 我们先按b排序, 然后枚举选两颗心的b的最大值, 在这个之前的肯定都要选一个, 因为前面的要是一个都没选的话, 你可以把当前选两颗心的替换成前面选两颗心, 然后用平衡树或者线段树维护一下前k大和就好啦. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #define mk make_pair #define P…
通过理解题意,我们发现: 当需要拐弯的时候,兔子需要先走回箱子的位置,再走向拐弯的方向.则拐弯操作的花费为 \(2\) .而直行的操作花费为 \(1\) . 所以, 如果不需要拐弯,也就是 \(x1=x2\) 或 \(y1=y2\) 时,直接计算花费. 如果需要拐弯,也就是 \(x1\neq x2\) 且 \(y1\neq y2\) 时,计算花费后再加2. //AC代码 #include<iostream> #include<cstdio> #include<algorith…
题面传送门 题意: 有 \(n\) 个关卡,第 \(i\) 个关卡玩到 \(1\) 颗星需要花 \(a_i\) 的时间,玩到 \(2\) 颗星需要 \(b_i\) 的时间.(\(a_i<b_i\)) 求玩到 \(w\) 颗星最少需要多少时间. \(1 \leq n \leq 3 \times 10^5\) yyq:"好题不常有,做过了就不能再错过了" 首先有一个显然的错误解法:初始将所有 \(a_i\) 压入优先队列,然后每次弹出优先队列中最小的值,如果它是一星的话就将 \(b_…
Cardboard Container Problem Description fidget spinners are so 2017; this years' rage are fidget cubes. A fidget cube is a cube with unit side lengths, which you hold in your hand and fidget with. Kids these days,right? You work in the planning depar…
Time Limit: 3000MS   Memory Limit: Unknown   64bit IO Format: %lld & %llu Submit Status Description   During the early stages of the Manhattan Project, the dangers of the new radioctive materials were not widely known. Vast new factory cities were bu…
1. CF 438D The Child and Sequence 大意: n元素序列, m个操作: 1,询问区间和. 2,区间对m取模. 3,单点修改 维护最大值, 取模时暴力对所有>m的数取模. 因为取模后至少减半, 复杂度$O(nlognlogC)$ 2. CF 431E Chemistry Experiment 大意: n个试管, 第$i$个试管有$a_i$单位水银, m个操作: 1, 修改$a_x$改为$v$. 2, 将$v$单位水倒入试管, 求一种方案使得有水的试管水银与水总量的最大…
水概率....SGU里难得的水题.... 495. Kids and Prizes Time limit per test: 0.5 second(s)Memory limit: 262144 kilobytes input: standardoutput: standard ICPC (International Cardboard Producing Company) is in the business of producing cardboard boxes. Recently the…
495. Kids and Prizes Time limit per test: 0.25 second(s)Memory limit: 262144 kilobytes input: standardoutput: standard ICPC (International Cardboard Producing Company) is in the business of producing cardboard boxes. Recently the company organized a…