题意:有1~N,n(1e5)个嫌疑人,有m个人说真话,每个人的陈述都形如X是凶手,或X不是凶手.现在给出n,m及n个陈述(以+x/-X表示)要求输出每个人说的话是true ,false or notdefine. 题解:模拟,依次假设每个人是犯人,统计说真话的有几个,如果 ==m 就符合. 现在考虑notdefine:当符合的情况数大于1时,就说明有notdefine. 因为枚举时,某一对-y-x,x是凶手时,-x是假话-y是真话,y是凶手时,-x真话-y假话.而其他人的陈述都与xy无关 所以模…
题目链接: http://codeforces.com/problemset/problem/657/C -------------------------------------------------------------------------------------------------------- 题目的特别之处在于只有 $+1$ $+5$ 这两种操作 我们要考虑如何利用这个条件 多想一下后可以发现 如果最优解的目标值为$x($将至少$k$个人的值增加到$x)$ 那么一定存在一个…
题意:给你两个数列a,b,你要输出k个下标,使得这些下标对应的a的和大于整个a数列的和的1/2.同时这些下标对应的b //题解:首先将条件换一种说法,就是要取floor(n/2)+1个数使得这些数大于剩下的数.然后想到两种取法,一种是排好序选前半段.令一种取法是两个两个分组,每组取大的那个.//然后就可以(很困难地)想到一种巧妙的取法,先用一个结构体保存a,b,idx,按照a从大到小排序,先取第一个,再对剩下的每两个一组取其中b更大的.这样保证了被选出//的b一定大于剩下的b,也就满足了条件.然…
http://codeforces.com/problemset/problem/55/C 题意:一个博弈. 题解:瞎猜,目前不清楚原理 #include<iostream> #include<stdio.h> #include<algorithm> using namespace std; typedef long long ll; int main(){ int n,m,k; cin>>n>>m>>k; ; ;i<=k;i+…
Suspects Time Limit:2000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u Submit Status Description As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the crime. T…
B. Suspects time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output As Sherlock Holmes was investigating a crime, he identified n suspects. He knows for sure that exactly one of them committed the…
题意简述: 给定一个$1$到$n(n<=2000)$的初始排列以及最终排列 我们每次可以选取位置为$i$和$j$的 并交换它们的位置 花费为$ |i-j| $ 求从初始状态变换到末状态所需最小花费 ----------------------------------------------------------------------------------------------------------- 比赛时这题留了$40min$ 然而自己贪心策略还是有漏洞 结束后看了首页的官方题解 感…
题意简述 给定一个由A C G T四个字母组成的密码锁(每拨动一次 A变C C变G G变T T变A) 密码锁有n位 规定每次操作可以选取连续的一段拨动1~3次 问最少几次操作可以将初始状态变到末状态 并且把每次操作输出 (此题有spj) --------------------------------------------------------------------------------------------------------- 为了方便叙述 所有没有明确说明的位置均是在$mod…
B. Jumping Jack Jack is working on his jumping skills recently. Currently he's located at point zero of the number line. He would like to get to the point x. In order to train, he has decided that he'll first jump by only one unit, and each subsequen…
找每个数的约数(暴力就够了...1~x^0.5)....看这约数的倍数最后是哪个数...若距离大于了y..统计++...然后将这个约数的最后倍数赋值为当前位置...好叼的想法题.... Program: #include<iostream> #include<stack> #include<queue> #include<stdio.h> #include<algorithm> #include<string.h> #include&…