【贪心+博弈】C. Naming Company】的更多相关文章

http://codeforces.com/contest/794/problem/C Description Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the…
Codeforces Round #228 (Div. 1) 题目链接:C. Fox and Card Game Fox Ciel is playing a card game with her friend Fox Jiro. There are n piles of cards on the table. And there is a positive integer on each card. The players take turns and Ciel takes the first…
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company. To settle this problem, they've decided to play…
http://codeforces.com/contest/794/problem/C 题意:A,B两人各有长度为n的字符串,轮流向空字符串C中放字母,A尽可能让字符串字典序小,B尽可能让字符串字典序大,A,B都知道对方的情况:A先手. 首先,A要C的字典序大,B要C的字典序小,所以先贪心,A的按从小到大排序,B的按从大到小排序. 那么现在我们已经知道了A,B分别要选择放到C的字符. 接下来博弈: B的最大字符等于小于A的最小字符: A走:A一定要B放到前面,所以A尽可能放到后面,放哪个呢?当然…
Oleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but they are having trouble finding a name for the company. To settle this problem, they've decided to play…
考虑两个人,先把各自的集合排个序,丢掉一半,因为比较劣的那一半一定用不到. 然后贪心地放,只有两种决策,要么把一个最优的放在开头,要么把一个最劣的放在结尾. 如果我的最优的比对方所有的都劣(或等于),我就把我最劣的往结尾放.否则我把我最优的往开头放. 用multiset维护两人的集合即可. #include<cstdio> #include<cstring> #include<algorithm> #include<set> using namespace…
题目链接:http://codeforces.com/contest/794/problem/C 题意:有两个人每个人都有一个长度为n的字符串,两人轮流拿出一个字符串,放在一个长度为n的字符串的指定位置中,第一个 人他想让最后组成的字符串尽可能小,另一个人想要字符串尽可能的大.他们互相知道各自手中有什么字符串,最后输出组成的 字符串 #include <iostream> #include <cstring> #include <string> #include <…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4647 注意这题两人的决策是想要使得自己的分数与对方的差值最大.. 注意到数据范围,显然是贪心之类的,如果没有变那么很简单,如果有边,那么我们进行拆边,把边的权值的一半加到所连的点上.然后排个序贪心.. //STATUS:C++_AC_218MS_1020KB #include <functional> #include <algorithm> #include <iostream…
心得: 这比赛真的是不要不要的,pending了一下午,也不知道对错,直接做过去就是了,也没有管太多! Problem A: 两只老虎 Description 来,我们先来放松下,听听儿歌,一起“唱”. 两只老虎两只老虎,跑得快跑得快. 一只没有耳朵,一只没有尾巴. 真奇怪,真奇怪. Tmk也觉得很奇怪,因为在他面前突然出现了一群这样的老虎,有的没耳朵,有的没尾巴,不过也有正常的. 现在Tmk告诉你这群老虎的耳朵个数,尾巴条数,以及老虎的腿的数目,问你有多少只是正常的. 其中只有三种老虎: 第一…
题目链接:传送门 思路: 分析到处理节点时的吃cookie的顺序了,然鹅不会用线段树维护前缀和.技术门槛QAQ... 很容易想到可以从root开始搜索,每次深入消耗时间2*边权w. 然后对于深入到点u开始返回的话,想要尽量多地吃cookie,就要贪心地选择用时短的cookie,也就是: 当前节点为u,剩余时间为val时,最多能在1-u这条链上吃到多少个cookie. 一共有1e6个节点,所以这个贪心策略的实现复杂度要压到log级别...好难不会. 思路参考:Dream_maker_yk的博客 线…