CodeForces - 1102B Array K-Coloring】的更多相关文章

B. Array K-Coloring time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output describe You are given an array a consisting of n integer numbers. You have to color this array in k colors in such a way th…
E. Array Queries 题目链接:http://codeforces.com/problemset/problem/797/E time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output a is an array of n positive integers, all of which are not greater than…
K. Perpetuum Mobile Time Limit: 2 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/K Description The world famous scientist Innokentiy almost finished the creation of perpetuum mobile. Its main part is the energy generator which…
You have written on a piece of paper an array of n positive integers a[1], a[2], ..., a[n] and m good pairs of integers (i1, j1), (i2, j2), ..., (im, jm). Each good pair (ik, jk) meets the following conditions: ik + jk is an odd number and 1 ≤ ik < j…
Given two integers n and k, find how many different arrays consist of numbers from 1 to n such that there are exactly k inverse pairs. We define an inverse pair as following: For ith and jth element in the array, if i < j and a[i] > a[j] then it's a…
题目链接:Array and Segments (Hard version) 题意:给定一个长度为n的序列,m个区间,从m个区间内选择一些区间内的数都减一,使得整个序列的最大值减最小值最大. 题解:利用差分的思想,并且考虑到m比较小,遍历一遍序列,当前点遇到需要改变的时候进行操作,同时更新答案. #include <set> #include <map> #include <queue> #include <deque> #include <stack…
题目链接:http://codeforces.com/gym/100971/problem/K K. Palindromization time limit per test 2.0 s memory limit per test 256 MB input standard input output standard output Mihahim has a string s. He wants to delete exactly one character from it so that th…
E. Inverse Coloring time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output You are given a square board, consisting of $$$n$$$ rows and $$$n$$$ columns. Each tile in it should be colored either w…
Codeforces 1108E2 E2. Array and Segments (Hard version) Description: The only difference between easy and hard versions is a number of elements in the array. You are given an array \(a\) consisting of \(n\) integers. The value of the \(i\)-th element…
http://codeforces.com/contest/805/problem/E [题意] 染色数是很好确定,最少染色数是max(si)(最小为1,即使所有的si都为0,这样是单节点树形成的森林需要1种颜色),关键是确定染色方案. 一开始没看出来树有什么用,但其实一句话很关键:Vertices which have the i-th (1 ≤ i ≤ m) type of ice cream form a connected subgraph. 也就是说在原来的图中,含有相同的冰淇淋的点是…