CodeForcesGym 100502G Outing】的更多相关文章

Outing Time Limit: 1000ms Memory Limit: 524288KB This problem will be judged on CodeForcesGym. Original ID: 100502G64-bit integer IO format: %I64d      Java class name: (Any) Organising a group trip for the elderly can be a daunting task... Not least…
题目链接 问题:有n个人,最多选k个,如果选了某个人就必须选他指定的另一个人,问最多能选多少个人. 将每个人所指定的人向他连一条单向边,则每一个点都有唯一的前驱,形成的图是个基环树森林,在同一个强连通分量里的点要么全选,要么全不选. 首先用Tarjan算法将每个强连通分量(基环树上的环)缩成一个点,这样每棵基环树就变成了普通的树了. 定义每颗树上没有入度的点为树根,建立一个虚根与每棵树的根连一条边,将森林转化成树,对根节点求一遍树形背包即可. 树形依赖背包是树形背包的一个特例,即树形背包在根节点…
Sign up:  2014 Summer Outing   请您从以下三个方案中选择您最感兴趣的一个项目, 如果您不能参加此次summer outing, 请选择"遗憾放弃"-  报名请点击这里   我们将根据此次报名人数与旅行社签约并按人数付费, 请您仔细考虑后再作出选择,报名截止后将不予更改, 未按时报名的同事按默认放弃处理  - 月31 日   Option 1:16 Aug (Sat) 薰衣草+水库山庄休闲一日游                                …
传送门 #1154 : Spring Outing 时间限制:20000ms 单点时限:1000ms 内存限制:256MB 描述 You class are planning for a spring outing. $N$ people are voting for a destination out of $K$ candidate places. The voting progress is below: First the class vote for the first candida…
Outing 题目描述 Organising a group trip for the elderly can be a daunting task... Not least because of the fussy participants, each of whom will only make the trip on condition that some other participant also comes. After some effort, you have taken fro…
Outing Input Output Sample Input 4 4 1 2 3 4 Sample Output 4 分组背包: for 所有的组k for v=V..0 for 所有的i属于组k f[v]=max{f[v],f[v-c[i]]+w[i]} 有一辆能载客m的车,有n个人,然后第i个人上车的条件是第a[i]个人要上车,问最多能上几个. 显然,一个连通块至多含有一个环.每一块的价值范围在[环点,块点]之间,将每一块视为一组,从每组的范围中任取一值,组成不超过m的最大值.因此可转换…
Dynamic LCA Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForcesGym. Original ID: 100512D64-bit integer IO format: %I64d      Java class name: (Any) 解题:LCT #include <bits/stdc++.h> using namespace std; ; struct arc { i…
IQ Test Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForcesGym. Original ID: 100517I64-bit integer IO format: %I64d      Java class name: (Any)   解题:动态规划 #include <bits/stdc++.h> using namespace std; typedef long long…
Bubble Sort Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForcesGym. Original ID: 100517B64-bit integer IO format: %I64d      Java class name: (Any)   解题:我们发现假设当前位选择1,那么发现比1大的并且没有使用的有b个,那么当前为选1,后面就还有$2^{b-1}$种方式,所以贪心的选,…
Hentium Scheduling Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForcesGym. Original ID: 100517H64-bit integer IO format: %I64d      Java class name: (Any)   解题:我擦,裸的网络流啊,居然没发现 #include <bits/stdc++.h> using namespace…