Voting CodeForces - 749C (set,模拟)】的更多相关文章

大意: n个人, 两个党派, 轮流投票, 两种操作(1)ban掉一个人 (2)投票, 每轮一个未被ban的人可以进行一次操作(1)或操作(2), 求最终哪个党派得票最多. 显然先ban人会更优, 所以维护两个set模拟. 不过好像可以有O(n)的做法? #include <iostream> #include <sstream> #include <algorithm> #include <cstdio> #include <math.h> #i…
有点意思的题 Voting CodeForces - 749C 题意:有n个人投票,每次按照第1个人~第n个人的顺序发言,如果到某个人发言时他已经被禁止发言就跳过,每个人发言时可以禁止另一个人发言或什么也不做.最后只剩下一个人时,那个人的意见就是最终决定的意见.这些人分为D和R两派,也就是每个人有D和R两种意见中的一种,每一派的人都希望自己派的意见成为最终意见.假设每个人都作出最优选择,请根据每个人的派别判断最终决定的意见. 方法:第i个人发言的时候,就按照第i~第n,第1~第i-1的顺序找出第…
FST的时候好像挂了挺多人的~ 其实思路没啥难的,就是更好地理解题意吧,1到n一直循环,直到没有人能vote,一个人能vote也能叉掉一个人,一个人被叉就不能vote,判谁赢. 其实我管vote干嘛,我管好互叉就好了啊,直到局势一边倒,也就是不能叉了,谁多谁赢,这样肯定是要么D多R多,复杂度不大. #include<bits/stdc++.h> using namespace std; typedef __int64 LL; const int N=2e5+10; bool vis[N]; c…
http://codeforces.com/problemset/problem/749/C 题意:有n个人投票,分为 D 和 R 两派,从1~n的顺序投票,轮到某人投票的时候,他可以将对方的一个人KO,被KO的人不能投票了,这样循环,直到某一派的人全部被KO,问哪方赢. 思路:模拟..代码好懂.. #include <cstdio> #include <algorithm> #include <iostream> #include <cstring> #i…
C. Voting time limit per test: 1 second memory limit per test: 256 megabytes input: standard input output: standard output There are n employees in Alternative Cake Manufacturing (ACM). They are now voting on some very important question and the lead…
C. Voting time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n employees in Alternative Cake Manufacturing (ACM). They are now voting on some very important question and the leading…
Fox and Cross Time Limit: 1000MS   Memory Limit: 262144KB   64bit IO Format: %I64d & %I64u Submit Status Description Fox Ciel has a board with n rows and n columns. So, the board consists of n × n cells. Each cell contains either a symbol '.', or a s…
Rebranding Problem Description The name of one small but proud corporation consists of n lowercase English letters. The Corporation has decided to try rebranding - an active marketing strategy, that includes a set of measures to change either the bra…
B. Cards time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Catherine has a deck of n cards, each of which is either red, green, or blue. As long as there are at least two cards left, she can…
C. Report time limit per test:2 seconds memory limit per test:256 megabytes input:standard input output:standard output Each month Blake gets the report containing main economic indicators of the company "Blake Technologies". There are n commodi…