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…
B. Cards Sorting time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Vasily has a deck of cards consisting of n cards. There is an integer on each of the cards, this integer is between 1 and 10…
cf的a题没什么好说到,100的量级,每个人给2张牌,使每个人手中的牌点数相等.保证有一种分配方案. 对每个人,先计算出手中的牌的点数,然后循环两遍拿牌就可以. A. Cards time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n cards (n is even) in the deck. Each c…
A. Cards time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output There are n cards (n is even) in the deck. Each card has a positive integer written on it. n / 2 people will play new card game. At…
将每个数字的位置存进该数字的vector中 原数组排个序从小到大处理,每次在vector里二分找到距离当前位置“最远”的位置(相差最大),更新答案 树状数组维护每个数字现在的位置和原位置之差 #include <bits/stdc++.h> using namespace std; #define LL long long ; int n; int a[N], b[N]; vector<int> v[N]; int c[N]; void modify(int x, int num)…