[AGC025B]RGB Color 题面描述 Link to Atcoder Link to Luogu Takahashi has a tower which is divided into \(N\) layers. Initially, all the layers are uncolored. Takahashi is going to paint some of the layers in red, green or blue to make a beautiful tower. H…
Resource Archiver Time Limit: 10000MS Memory Limit: 100000KB 64bit IO Format: %I64d & %I64u Description Great! Your new software is almost finished! The only thing left to do is archiving all your n resource files into a big one. Wait a minute… y…
[CF886E]Maximum Element 题意:小P有一个1-n的序列,他想找到整个序列中最大值的出现位置,但是他觉得O(n)扫一遍太慢了,所以它采用了如下方法: 1.逐个遍历每个元素,如果这个元素比当前记录的最大值大,则令最大值等于当前元素,并令cnt=02.如果这个元素没有当前元素大,则cnt++.3.如果cnt=k,则返回当前最大值 现在小P想知道有多少种序列在使用他的方法时会得到错误的答案.为了简化问题,我们假定原序列是一个1-n的排列.即我们要求的是:给定n和k,有多少个1-n的…
[BZOJ2310]ParkII Description Hnoi2007-Day1有一道题目 Park:给你一个 m * n 的矩阵,每个矩阵内有个权值V(i,j) (可能为负数),要求找一条回路,使得每个点最多经过一次,并且经过的点权值之和最大,想必大家印象深刻吧. 无聊的小 C 同学把这个问题稍微改了一下:要求找一条路径,使得每个点最多经过一次,并且点权值之和最大,如果你跟小 C 一样无聊,就麻烦做一下这个题目吧. Input 第一行 m, n,接下来 m行每行 n 个数即. V( i,j…
[BZOJ2213][Poi2011]Difference Description A word consisting of lower-case letters of the English alphabet ('a'-'z') is given. We would like to choose a non-empty contiguous (i.e. one-piece) fragment of the word so as to maximise the difference in the…