Gym - 101480K_K - Kernel Knights (DFS)】的更多相关文章

题意:有两队骑士各n人,每位骑士会挑战对方队伍的某一个位骑士. (可能相同) 要求找以一个区间s: 集合S中的骑士不会互相挑战. 每个集合外的骑士必定会被集合S内的某个骑士挑战. 题解:讲真被题目绕懵比了,一直不知道题目在要求找啥. 骑士可以分为三类:必定在s中,必定不再s中,不确定的. 如果一个骑士的被挑战人数为0的话,那么他一定在s中.(否则就违背了2) 如果一个骑士挑战了确定在s内的骑士,那么他一定在圈外. 若某个骑士i被多个人挑战,那么要先对这些挑战者逐一进行上述判断,若某个挑战者被确定…
Kernel Knights 题目链接: http://acm.hust.edu.cn/vjudge/contest/127407#problem/K Description Jousting is a medieval contest that involves people on horseback trying to strike each other with wooden lances while riding at high speed. A total of 2n knights…
[Cerc2015]Kernel Knights Time Limit: 2 Sec Memory Limit: 512 MBSubmit: 5 Solved: 4[Submit][Status][Discuss]Description “Jousting”是一种让骑士在高速骑行中用木制长矛相互攻击对方的中世纪竞技游戏.现在,一共有2n个骑士进入一场“Jousting”锦标赛.骑士们被平均分配到2个house.竞赛开始时,所有骑士都会对另一个house的骑士之一发起挑战.一组解被定义为一个集合S…
题目链接 #include <bits/stdc++.h> using namespace std; typedef long long ll; int a[200005]; //存放原始数据 int vis[200005]; //标记选的对手 int b[200005]; //答案序列 queue<int>q; //把所有能够选的都存一次,接着遍历与它有关系的. int main() { int n,x; scanf("%d",&n); memset(…
Board Game Time Limit:2000MS     Memory Limit:65536KB     64bit IO Format:%I64d & %I64u  Gym 100935G Description standard input/outputStatements Feras bought to his nephew Saleem a new game to help him learning calculating. The game consists of a boa…
题 题意 有两个队的骑士1到n和n+1到2n,每个骑士只能互相攻击对手队的一个骑士.kernel的意思是在这个kernel里的骑士不会互相攻击,在kernel外的骑士被kernel里的骑士攻击. 现在告诉你所有骑士攻击的骑士,求一个kernel. 分析 没人攻击的骑士一定在kernel里,把没人攻击的加入队列,然后被他攻击的骑士一定在kernel外. kernel外的骑士的攻击无效,因为如果一个骑士如果只被外面的骑士攻击,他就是kernel里的. 于是 被 外面的骑士攻击 的骑士 的被攻击次数…
题目链接:http://codeforces.com/gym/101466/problem/K 题目: 题意: 给你一棵有n个节点的树,根节点始终为0,有两种操作: 1.RAND:查询以u为根节点的子树上的所有节点的权值的乘积x,及x的因数个数. 2.SEED:将节点u的权值乘以x. 思路: 比赛时少看了因数不大于13这句话,然后本题难度增加数倍,肝了两个小时都没肝出来,对不起队友啊,今天的组队训练赛实力背锅…… 这题一眼线段树,由于是对一棵子树进行处理,因此我们采用常规套路,借助dfs序将子树…
Problem E: Reliable NetsYou’re in charge of designing a campus network between buildings and are very worried about itsreliability and its cost. So, you’ve decided to build some redundancy into your network while keeping itas inexpensive as possible.…
Problem H: Two EndsIn the two-player game “Two Ends”, an even number of cards is laid out in a row. On each card, faceup, is written a positive integer. Players take turns removing a card from either end of the row andplacing the card in their pile.…
Problem D: Queens, Knights and PawnsTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://acm.hust.edu.cn/vjudge/contest/view.action?cid=88443#problem/D Description You all are familiar with the famous 8-queens problem which asks you to place 8 queens…