codeforce Round #599(Div.2)】的更多相关文章

题目传送门 A. Maximum Square 题目意思是给你n个长条,每个长条的高度是num[i](0 < i < n),每一条的宽度都是 1 :然后求这些长条可以组成的最大面积的正方形的宽度是多少,将它输出来. 题目分析 :因为要求的是正方形,而且面积是最大的,所以既要看它的宽度也要看它的高度.因为多余的面积可以删除掉,所以我们只需要知道min(长,宽). 所以可以将所有的长度排个序,然后从大到小历经一遍就可以了. #include <iostream> #include &l…
Codeforces Round #599 (Div. 2) D. 0-1 MST Description Ujan has a lot of useless stuff in his drawers, a considerable part of which are his math notebooks: it is time to sort them out. This time he found an old dusty graph theory notebook with a descr…
A. Olympiad 给出n个数,让你找出有几个非零并且不重复的数 所以用stl的set //#define debug #include<stdio.h> #include<math.h> #include<cmath> #include<queue> #include<stack> #include<string> #include<cstring> #include<string.h> #include…
C. Phone Numbers time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output And where the are the phone numbers? You are given a string s consisting of lowercase English letters and an integer k. Find th…
B. Our Tanya is Crying Out Loud time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Right now she actually isn't. But she will be, if you don't solve this problem. You are given integers n, k, A an…
构造题 话说挺水的题..当时怎么就WA到自闭呢.. 先把每个位置按照最低要求填满,也就是相差1..然后从最后一位开始把剩下的数加上,直到不能加为止. #include <bits/stdc++.h> #define INF 0x3f3f3f3f #define full(a, b) memset(a, b, sizeof a) using namespace std; typedef long long ll; inline int lowbit(int x){ return x &…
数论 gcd 看到这个题其实知道应该是和(a+k)(b+k)/gcd(a+k,b+k)有关,但是之后推了半天,思路全无. 然而..有一个引理: gcd(a, b) = gcd(a, b - a) = gcd(b, b - a) (b > a) 证明一下: 令 gcd(a, b) = c, (b > a) 则有 a % c = 0, b % c = 0 那么 (a - b) % c = 0 令 gcd(a, b - a) = c', 假设c' != c 则有 a % c' = 0, (b - a…
dp 找规律 我好菜啊好菜啊,完全没有思路. 在合法的括号序列中,左括号数一定大于等于右括号数的,所以我们可以先定义平衡度为左括号数-右括号数. 然后可以发现一个惊人的规律..就是在trie同一深度上的点,如果平衡度相同,那么他的子树完全一样.. 官方的题解给出了几个栗子: ((()) , ()()( , (())( 然后我们对于他们的状态都可以用同一个表示方法表示. 对于树上的最大边独立,为们对每个点,可以看他的父亲节点有没有被选过,如果被选过了,那么该点与父亲的边就不能选,反之则选择数量加1…
题意(CodeForces 614D) 每个人有\(n(n\le 10^5)\)个技能,技能等级都在\([0,10^9]\)的范围,每个技能有一个当前等级,所有技能的最高等级都为A.一个人的力量被记做以下两项的和: 1. 顶级技能的个数 *cf 2. 最低等级的技能 *cm 每个单位的钱能够提升一级力量.我们希望花尽可能少的钱,使得力量尽可能高. 分析 我二分的功力还是不足,要多努力.这题其实是一个非常明显的暴力:我们枚举提高到A的等级的个数(到不能提升为止),枚举这种情况下,我们能够令把多少人…
题意 (CodeForces 617E) 已知一个长度为\(n\)的整数数列\(a[1],a[2],-,a[n]\),给定查询参数\(l,r\),问\([l,r]\)内,有多少连续子段满足异或和等于\(k\). 也就是说,对于所有的\(x,y (l\le x\le y\le r)\),能够满足\(a[x]\oplus a[x+1]\oplus ...\oplus a[y]=k\)的\((x,y)\)有多少组. 分析 对于这种离线区间的查询问题(不涉及对区间的更改),我们可以使用莫队算法解决.这类…