Entertainment Box 题意: 有n个节目,每个节目给出开始时间(st)和结束时间(en): 有k个内存条这k个内存条可以同时存储节目.如果节目j的开始时间stj  大于等于节目i的结束时间,就可以放进内存条中: 问这k个内存条最多可以存储多少个节目. 思路:开一个multiset容器,开始压入k个0,表示k个内存条,这k个数表示存入的该内存条的最后一个节目的结束时间.将所有的节目按结束时间由小到大排序,然后遍历所有节目的开始时间,查找最后一个小于等于当前开始时间的结束时间,更新,记…
提交链接 http://codeforces.com/gym/100781/submit Description: Ada, Bertrand and Charles often argue over which TV shows to watch, and to avoid some of their fights they have finally decided to buy a video tape recorder. This fabulous, new device can reco…
题目:http://codeforces.com/contest/389/problem/C 题意:给n个箱子,给n个箱子所能承受的重量,每个箱子的重量为1: 很简单的贪心,比赛的时候没想出来...... 先从小到大排一下序,然后从最上层向下找,只要能承受住重量就行.而且因为已经排序了找的都是尽量小的... #include <iostream> #include <cstdio> #include <cstring> #include <cstdlib>…
Ada, Bertrand and Charles often argue over which TV shows to watch, and to avoid some of their fights they have finally decided to buy a video tape recorder. This fabulous, new device can record kk different TV shows simultaneously, and whenever a sh…
本题出自: Nordic Collegiate Programming Contest 2015​ Ada, Bertrand and Charles often argue over which TV shows to watch, and to avoid some of their fights they have finally decided to buy a video tape recorder. This fabulous, new device can record k diffe…
一 题面 E. Minimum Array 二 分析 注意前提条件:$0 \le  a_{i} \lt n$ 并且 $0 \le  b_{i} \lt n$.那么,我们可以在$a_{i}$中任取一个数进行分析,发现为满足字典序最小,在$b$中找到$n-a_{i}$就是最优解. 接下来分析$b$,在$b$中是不一定找得到$n-a_{i}$的.所以需要分析如何找到此情况下的最优解. 假设$a_{i} = 3$,$n = 4$,那么$b_{i}$对应的最优情况是$b_{i} = 1$,可以把所有$b_…
Ada, Bertrand and Charles often argue over which TV shows to watch, and to avoid some of their fights they have finally decided to buy a video tape recorder. This fabulous, new device can record kk different TV shows simultaneously, and whenever a sh…
D2. Optimal Subsequences (Hard Version) This is the harder version of the problem. In this version, 1≤n,m≤2⋅105. You can hack this problem if you locked it. But you can hack the previous problem only if you locked both problems. You are given a seque…
题意:你有\(n\)个礼物,礼物有自己的种类,你想将它们按种类打包送人,但是打包的礼物数量必须不同(数量,与种类无关),同时,有些礼物你想自己留着,\(0\)表示你不想送人,问你在送出的礼物数量最大的同时,尽可能的使自己喜欢的留下来,输出能送出的最大礼物数,以及这些礼物中自己不喜欢的数目. 题解:首先,我们肯定要让送出的礼物数最大,同时喜欢的最小,也就是送的礼物中,尽量让它的\(f\)是\(1\).这题考虑贪心,我们可以先对礼物数量进行排序,礼物数量相同让\(1\)多的排在前面,全部丢进优先队列…
Bounding Box的数据结构为(xmin,ymin,xmax,ymax) 输入:box1,box2 输出:IOU值 import numpy as np def iou(box1,box2): assert box1.size()==4 and box2.size()==4,"bounding box coordinate size must be 4" bxmin = np.max(box1[0],box2[0]) bymin = np.max(box1[1],box2[1])…