Mike has always been thinking about the harshness of social inequality. He's so obsessed with it that sometimes it even affects him while solving problems. At the moment, Mike has two sequences of positive integers A = [a1, a2, ..., an] and B = [b1, …
题目链接 Mike and distribution 题目意思很简单,给出$a_{i}$和$b_{i}$,我们需要在这$n$个数中挑选最多$n/2+1$个,使得挑选出来的 $p_{1}$,$p_{2}$,$p_{3}$,...,$p_{m}$满足 $a_{p1}+a_{p2}+a_{p3}+...+a_{p_{m}}>a_{1}+a_{2}+a_{3}+...+a_{n}$ $b_{p1}+b_{p2}+b_{p3}+...+b_{p_{m}}>b_{1}+b_{2}+b_{3}+...+b_…
D. Mike and distribution time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has always been thinking about the harshness of social inequality. He's so obsessed with it that sometimes it…
Mike and distribution 题目链接:http://codeforces.com/problemset/problem/798/D 数据范围:略. 题解: 太难了吧这个题..... 这种贪心根本就不咋会....接下来刷一段时间Atcoder看看好了..... 就是想到先把所有的对按照$a$排序. 然后刨除第一个外,相邻的两个分组. 第一个数单独一组,剩下的两两一组选$b$值较大的那对即可. 证明: 首先,因为我们按照$a$排序,所以上一组的选取的$a$一定不比当前组剩下的$a$小…
http://codeforces.com/contest/798/problem/D D. Mike and distribution time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has always been thinking about the harshness of social inequality.…
/* CF410div2 D. Mike and distribution http://codeforces.com/contest/798/problem/D 构造 题意:给出两个数列a,b,求选出n/2+1个数对,使得其和的二倍大于各自的数列 思路:对数列a进行排序,因为可以选一半加1个,所以最大的那个我们选出来 然后在剩下的数列中,每隔两个选则b中较大的, 这样可以保证选出的在b中满足条件,并且在a中也满足条件 然而....我他喵的居然忘了读入b数列!!!! */ #include <c…
CF798D Mike and distribution 洛谷评测传送门 题目描述 Mike has always been thinking about the harshness of social inequality. He's so obsessed with it that sometimes it even affects him while solving problems. At the moment, Mike has two sequences of positive in…
codeforces 547E Mike and Friends 题意 题解 代码 #include<bits/stdc++.h> using namespace std; #define fi first #define se second #define mp make_pair #define pb push_back #define rep(i, a, b) for(int i=(a); i<(b); i++) #define per(i, a, b) for(int i=(b)…
D. Mike and distribution time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike has always been thinking about the harshness of social inequality. He's so obsessed with it that sometimes it…
题目链接:http://codeforces.com/problemset/problem/798/C 题意:给你n个数,a1,a2,....an.要使得gcd(a1,a2,....an)>1,可以执行一次操作使ai,ai+1变为ai - ai + 1, ai + ai + 1.求出使得gcd(a1,a2,....an)>1所需要的最小操作数. 解题思路:首先,要知道如果能够实现gcd(a1,a2,....an)>1,那么a1~an肯定都是偶数(0也是偶数),所以我们的目的就是用最少的操…
1.codeforces 349B Color the Fence 2.链接:http://codeforces.com/problemset/problem/349/B 3.总结: 刷栅栏.1-9每个字母分别要ai升油漆,问最多可画多大的数字. 贪心,也有点考思维. #include<bits/stdc++.h> using namespace std; #define LL long long #define INF 0x3f3f3f3f int main() { ]; while(…
传送门 B. Mike and Fun time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike and some bears are playing a game just for fun. Mike is the judge. All bears except Mike are standing in an n × m g…
C. Mike and gcd problem time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output Mike has a sequence A = [a1, a2, ..., an] of length n. He considers the sequence B = [b1, b2, ..., bn] beautiful…