codeforces 982D Shark】的更多相关文章

题意: 给出一个数组,删除大于等于k的数字,使得其满足以下条件: 1.剩余的连续的段,每一段的长度相等: 2.在满足第一个条件的情况下,段数尽可能多: 3.在满足前两个条件的情况下,k取最小的. 求k. 思路: 一开始整个数组可以看成完整的一段,这是对应的k是最大的数字 + 1. 用一个set sd维护删除的数字. 从大到小枚举删除的数字,每次删除一个数字,都可以看成是删除一个长的段,然后添加两个小的段,在sd中找出这个数字的位置cur的前驱pre和后继sub,要删除的段就是前驱到后继这一段,然…
Codeforces Codeforces Round #484 (Div. 2) D. Shark 题目连接: http://codeforces.com/contest/982/problem/D Description For long time scientists study the behavior of sharks. Sharks, as many other species, alternate short movements in a certain location and…
题目链接: http://codeforces.com/problemset/problem/621/E E. Wet Shark and Blocks time limit per test2 secondsmemory limit per test256 megabytes 问题描述 There are b blocks of digits. Each one consisting of the same n digits, which are given to you in the inp…
http://codeforces.com/problemset/problem/621/E E. Wet Shark and Blocks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are b blocks of digits. Each one consisting of the same n digit…
题 Today, Wet Shark is given n integers. Using any of these integers no more than once, Wet Shark wants to get maximum possible even (divisible by 2) sum. Please, calculate this value for Wet Shark. Note, that if Wet Shark uses no integers from the n …
题 There are n sharks who grow flowers for Wet Shark. They are all sitting around the table, such that sharks i andi + 1 are neighbours for all i from 1 to n - 1. Sharks n and 1 are neighbours too. Each shark will grow some number of flowers si. For i…
B. Wet Shark and Bishops time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output Today, Wet Shark is given n bishops on a 1000 by 1000 grid. Both rows and columns of the grid are numbered from…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output There are b blocks of digits. Each one consisting of the same n digits, which are given to you in the input. Wet Shark must choose exactly one d…
Shark 题意:一个研究员观察了一条鲨鱼n天的运动,然后这条鲨鱼他只会往前走,不会回到去过的地方,现在有一个k,,如果鲨鱼当天游过的距离 >= k, 代表的鲨鱼在这天会前往下一个地点,现在求鲨鱼在每个停留的地点所待的时间是一样的,然后在上面那个情况下使得鲨鱼所待得地点数目最多,然后再地点数目的情况下保证K最小. 题解:从小到大处理元素,每次将k = 当前元素+1,因为只有k比一个元素大了才会有新的停留地点,然后对于所有出现过的元素鲨鱼都会在这个点停留,然后我们需要对每一段连续的停留片段计算出他…
E. Wet Shark and Blocks time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output There are b blocks of digits. Each one consisting of the same n digits, which are given to you in the input. Wet Sha…