Manthan, Codefest 17】的更多相关文章

A. Tom Riddle's Diary time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Harry Potter is on a mission to destroy You-Know-Who's Horcruxes. The first Horcrux that he encountered in the Chamber…
[链接]h在这里写链接 [题意]     k是最高级别的分数,最高界别的分数最多只能有x个.     1<=k<=m;     和k相邻的点的分数只能小于k;     n个点的树,问你每个点的分数的安排,方案数%1e9+7 [题解]     设     f[i][j][0];//这棵子树下面有j个最高级别的点,这个点放Top点的方案数     f[i][j][1];//这棵子树下面有j个最高级别的点,这个点放小于等于k-1的点的方案数     f[i][j][2];//这棵子树下面有j个最高级…
[链接]h在这里写链接 [题意] 给你n个数字; 让你在其中找出三个数字i,j,k(i<=j<=k); 使得p*a[i]+q*a[j]+r*a[k]最大; [题解] /*     有一个要求i<=j<=k;     也就是说系数之间的下标是有关系的.     枚举第一个位置的下标i;         则第二个人j         i<=j<n         枚举中间那个人的位置在哪.     求出前i个位置,第一个人能获得的最大值是多少     求出后n-i个位置,第…
[链接]h在这里写链接 [题意] 在这里写题意 [题解] /* Be careful. 二重循环枚举 */ [错的次数] 0 [反思] 在这了写反思 [代码] #include <bits/stdc++.h> using namespace std; int n; string s[110]; int main() { //freopen("F:\\rush.txt", "r", stdin); scanf("%d", &n)…
Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)-C. Magic Grid-构造 [Problem Description] ​ 给你一个\(n\),构造一个\(n\times n\)的矩阵,使其满足任意一行,或一列的异或值相同.保证\(n\)能被\(4\)整除. [Solution] ​ 可以发现,从\(0\)开始,每\(4\)个连续数的异或值为\(0\),所以可以很容易使得每一行的异或值等于\(0\). ​ 列…
Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)-D. Restore Permutation-构造+树状数组 [Problem Description] ​ 给你一个长度为\(n\)的数组,第\(i\)个元素\(s_i\)表示一个排列中第\(i\)个元素之前,并且小于\(p_i\)的元素的和.求出满足此条件的排列. [Solution] ​ 假设\(n=5\),\(s[]=\{0,0,3,7,3\}\).从后往前看…
Manthan, Codefest 19 (open for everyone, rated, Div. 1 + Div. 2)-E. Let Them Slide-思维+数据结构 [Problem Description] ​ \(n\times w\)的方格中,每一行有\(cnt_i\)个数字,每一行的数字都连续的放在一起,但是可以任意的平移.问每一列的最大和为多少. [Solution] ​ 最直观的想法是对于每一列\(j\),计算出每一行中的一个区间最大值,此区间长度为\(len=w-c…
传送门 A. XORinacci 签到. Code /* * Author: heyuhhh * Created Time: 2020/2/26 9:26:33 */ #include <iostream> #include <algorithm> #include <cstring> #include <vector> #include <cmath> #include <set> #include <map> #inc…
D. Fibonacci-ish time limit per test 3 seconds memory limit per test 512 megabytes input standard input output standard output Yash has recently learnt about the Fibonacci sequence and is very excited about it. He calls a sequence Fibonacci-ish if th…
B. A Trivial Problem time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mr. Santa asks all the great programmers of the world to solve a trivial problem. He gives them an integer m and asks f…