题目链接: http://codeforces.com/problemset/problem/292/E E. Copying Data time limit per test2 secondsmemory limit per test256 megabytes 问题描述 We often have to copy large volumes of information. Such operation can take up many computer resources. Therefore…
E. Copying Data time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output We often have to copy large volumes of information. Such operation can take up many computer resources. Therefore, in this p…
Copying Data Time Limit:2000MS Memory Limit:262144KB 64bit IO Format:%I64d & %I64u Description We often have to copy large volumes of information. Such operation can take up many computer resources. Therefore, in this problem you are advised to come…
问满足a^3 + b^3 + c^3 + n = (a+b+c)^3 的 (a,b,c)的个数 可化简为 n = 3*(a + b) (a + c) (b + c) 于是 n / 3 = (a + b)(a + c) (b + c) 令x = a + b,y = a + c,z = b + c,s = n / 3 s = xyz 并且令x <= y <= z,于是我们解s = xyz这个方程,可以枚举x,y得到z. 得到(x,y,z)后便可以得到a,b,c但可能有不符合条件的三元组,化简系数矩…
292D - Connected Components D. Connected Components time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output We already know of the large corporation where Polycarpus works as a system administrato…
[BZOJ 3110] [luogu 3332] [ZJOI 2013]k大数查询(权值线段树套线段树) 题面 原题面有点歧义,不过从样例可以看出来真正的意思 有n个位置,每个位置可以看做一个集合. 1 a b c :在a-b的每个集合中插入一个数c 2 a b c :2:询问将a-b的每个集合合并到一起后所有元素的第c大 分析 外层用权值线段树维护值,内层用普通线段树维护位置 我们先考虑全局询问第k大的情况,显然只需要权值线段树维护全局值的出现情况,区间[L,R]存储值落在[L,R]内的元素数…
D. The Bakery time limit per test 2.5 seconds memory limit per test 256 megabytes input standard input output standard output Some time ago Slastyona the Sweetmaid decided to open her own bakery! She bought required ingredients and a wonder-oven whic…
F - Permutation 思路:对于当前的值x, 只需要知道x + k, x - k这两个值是否出现在其左右两侧,又因为每个值只有一个, 所以可以转换成,x+k, x-k在到x所在位置的时候是否都出现,或者都不出现,即出现情况相等,我们可以 用线段树维护hash值的方式来判断所有x+k, x-k的出现情况是否都一样. #include<bits/stdc++.h> #define LL long long #define fi first #define se second #defi…