[codeforces/edu5]总结(F)】的更多相关文章

链接:http://codeforces.com/contest/616 A题: 统一成1e6长度的字符串,右对齐比较字典序. B题: 求所有行的最小值,里面最大的那个.暴力. C题: 先用dfs给每个位置标记一个连通块编号.然后对于每个*,直接看一下上下左右合并一下(不是真的合并)看一下大小. D题: 用map维护一下每种数字出现的次数,从左到右枚举左端点,右端点是决策单调的.双指针O(n)扫一遍. E题: $n \mod i = n - [\frac{n}{i}]*i$ F题: 待补.…
Problem   Codeforces #541 (Div2) - F. Asya And Kittens Time Limit: 2000 mSec Problem Description Input The first line contains a single integer nn (2≤n≤150000) — the number of kittens. Each of the following n−1lines contains integers xi and yi (1≤xi,…
Educational Codeforces Round 40 F. Runner's Problem 题意: 给一个$ 3 * m \(的矩阵,问从\)(2,1)$ 出发 走到 \((2,m)\) 的方案数 \(mod 1e9 + 7\), 走的规则和限制如下: From the cell (i, j) you may advance to: (i - 1, j + 1) - only if i > 1, (i, j + 1), or (i + 1, j + 1) - only if i <…
F. Doomsday Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100187/problem/F Description Doomsday comes in t units of time. In anticipation of such a significant event n people prepared m vaults in which, as they think, it will…
F. FloodTime Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100685/problem/F Description We all know that King Triton doesn't like us and therefore shipwrecks, hurricanes and tsunami do happen. But being bored with the same routine…
F. Ilya Muromets Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/problem/F Description I Ilya Muromets is a legendary bogatyr. Right now he is struggling against Zmej Gorynych, a dragon with n heads numbered from 1 to nf…
https://codeforces.com/contest/1132/problem/F 思维 + 区间dp 题意 给一个长度为n的字符串(<=500),每次选择消去字符,连续相同的字符可以同时消去,问最少需要消去多少次 题解 定义dp[l][r]为区间[l,r]剩下一个字符所需要的最小次数 dp[l][r]=min(dp[l][i]+dp[i+1][r]+x) x为消去剩下两个字符所需要的次数,假如两个字符相同需要x=-1 代码 #include<bits/stdc++.h> #de…
https://codeforces.com/contest/1051/problem/F 题意 给一个带权联通无向图,n个点,m条边,q个询问,询问两点之间的最短路 其中 m-n<=20,1<=n,m<=1e5 思路 因为图一定联通,所以n-1<=m<=n+20 因为是求任意两点的最短路,所以直接暴力跑最短路是不行的,考虑选择性的跑最短路 因为是求两点之间的距离,所以可以往lca方面想 先跑一棵生成树出来,然后处理出每个点的lca,这样就可以求出任意两点的距离 然后就可以记…
F. Ilya Muromets Time Limit: 20 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/gym/100513/problem/F Description I Ilya Muromets is a legendary bogatyr. Right now he is struggling against Zmej Gorynych, a dragon with n heads numbered from 1 to nf…
F. Four Divisors 题目连接: http://www.codeforces.com/contest/665/problem/F Description If an integer a is divisible by another integer b, then b is called the divisor of a. For example: 12 has positive 6 divisors. They are 1, 2, 3, 4, 6 and 12. Let's def…