D. Salary Changing 大意: 有n个变量, 每个变量有一个取值区间, 要求给这n个变量赋值, 使得n个变量的和不超过S且中位数尽量大(n一定为奇数) 二分答案, 中位数大于等于mid就是问能不能有(n+1)/2个变量的值大于等于mid, 排序贪心就完事了. #include<cstdio> #include<algorithm> using namespace std; typedef long long i64; const int maxn = 200002;…
链接: https://codeforces.com/contest/1251/problem/D 题意: You are the head of a large enterprise. n people work at you, and n is odd (i. e. n is not divisible by 2). You have to distribute salaries to your employees. Initially, you have s dollars for it,…
On Changing Tree Time Limit: 2000ms Memory Limit: 262144KB This problem will be judged on CodeForces. Original ID: 396C64-bit integer IO format: %I64d Java class name: (Any) You are given a rooted tree consisting of n vertices numbered from 1 …
目录 Contest Info Solutions A. Broken Keyboard B. Binary Palindromes C. Minimize The Integer D. Salary Changing E2. Voting (Hard Version) Contest Info Practice Link Solved A B C D E1 E2 F 6/7 O O O O O O - O 在比赛中通过 Ø 赛后通过 ! 尝试了但是失败了 - 没有尝试 Solutions A.…
10.25 去打 CF,然后被 CF 打了. CF EDU 75 A. Broken Keyboard 精神恍惚,WA 了一发. B. Binary Palindromes 比赛中的憨憨做法,考虑一个串的 case,只有"长度为偶数,01都出现奇数次",才会变不出回文串,我们称这样的串为 Bad 的,其它串是 Good 的.两个 Bad 串,之间交换一个 01,可都变成 Good 的.如果 Bad 串有奇数个,那么必存在一个长度为奇数的串才可能合法. C. Minimize The I…