Contest 982】的更多相关文章

A 直接模拟即可,为了方便边界判断建议用 !=. 时间复杂度 \(O\left(n\right)\). B \(w\) 排序来处理内向者,坐人后丢进大根堆来处理外向者. 时间复杂度 \(O\left(n\log n\right)\). C 这里讲一种直接暴力树形 DP 的做法. 令 \(f_{u,0/1}\) 表示只考虑以 \(u\) 为根的子树,\(u\) 结点所在连通块大小奇偶性,最多的删边数量.若不合法值为 \(-\infty\). 仔细一分析你会发现 \(f_{u,0}\) 和 \(f_…
Codeforces Codeforces Round #484 (Div. 2) E. Billiard 题目连接: http://codeforces.com/contest/982/problem/E Description Consider a billiard table of rectangular size $n \times m$ with four pockets. Let's introduce a coordinate system with the origin at t…
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/contest/982 A. Row time limit per test:1 second memory limit per test:256 megabytes input:standard input output:standard output You're given a row with nn chairs. We call a seating of people "maximal" if the two follow…
2018/5/6 Codeforces Round #478 (Div. 2) C http://codeforces.com/contest/975/problem/C Valhalla Siege 题意:n的士兵,每个士兵有一些生命值,有q次询问,每次询问从前向后造成ki点贯穿伤害(生命值归零的士兵死去,后续士兵承受溢出伤害),问每次询问有几个士兵还活着.当所有士兵死去时,不继续造成溢出伤害并且所有士兵复活. 思路:二分搜索,对士兵生命值求前缀和,每次询问造成的伤害累计,记为s,用upper…
https://codeforces.com/contest/958/problem/E2 首先求出N个时刻的N-1个间隔长度,问题就相当于在这些间隔中选K个数,相邻两个不能同时选,要求和最小 方法1: 一个K^2的做法,有一定技巧 https://www.cnblogs.com/void-f/p/8867585.html 方法2: 是可撤销贪心的模板? 就是贪心的选权值最小的,但是在选完某一个位置i后把它前一个没有被删的位置pre[i]和后一个没有被删的位置nxt[i]删掉,将i的权值变为(-…
原博主:https://blog.csdn.net/amovement/article/details/80358962 B. Bus of Characters time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output In the Bus of Characters there are nn rows of seat, each h…
Contest 121 (题号981-984)(2019年1月27日) 链接:https://leetcode.com/contest/weekly-contest-121 总结:2019年2月22日补充的报告.当时不想写.rank:1093/3924,AC:2/4.还是太慢了. [984]String Without AAA or BBB(第一题 4分)(Greedy, M) 给了两个数字,A 代表 A 个 ‘A’, B 代表 B 个‘B’ 在字符串里面.返回一个可行的字符串,字符串中包含 A…
    Programming Contest Problem Types Hal Burch conducted an analysis over spring break of 1999 and made an amazing discovery: there are only 16 types of programming contest problems! Furthermore, the top several comprise almost 80% of the problems s…
Area of Mushroom Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 2390    Accepted Submission(s): 578 Problem Description Teacher Mai has a kingdom with the infinite area. He has n students guard…