自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

原创 cf R327 div2 D

#include using namespace std;const int N = 100100;vector L;long long bit[N * 4];void add(int x, int v) { for (int i = x; i <= 400000; i += i & -i) bit[i] += v;}long long get(int x) {

2015-12-27 22:11:57 321

原创 USACO Section 2.3 Longest Prefix

The structure of some biological objects is represented by the sequence of their constituents, where each part is denoted by an uppercase letter. Biologists are interested in decomposing a long sequen

2015-11-17 00:40:20 241

原创 USACO Section 2.2 Party Lamps

To brighten up the gala dinner of the IOI'98 we have a set of N (10 N.The lamps are connected to four buttons:Button 1: When this button is pressed, all the lamps change their state: those tha

2015-11-17 00:37:46 247

原创 USACO Section 2.2 Runaround Numbers

Runaround numbers are integers with unique digits, none of which is zero (e.g., 81362) that also have an interesting property, exemplified by this demonstration:If you start at the left digit (8 i

2015-11-17 00:35:41 229

原创 USACO Section 2.2 Subset Sums

For many sets of consecutive integers from 1 through N (1 For example, if N=3, one can partition the set {1, 2, 3} in one way so that the sums of both subsets are identical:{3} and {1,2}This counts as

2015-11-17 00:24:24 221

原创 USACO Section 2.2 Preface Numbering

Preface Numbering A certain book’s prefaces are numbered in upper case Roman numerals.Traditional Roman numeral values use a single letter to represent a certainsubset of decimal numbers. Here is th

2015-11-17 00:10:35 239

转载 (转) 果巨的模板

常用头文件和宏/* #pragma warning (disable: 4786) #pragma comment (linker, "/STACK:0x800000") */#include <cassert>#include <cctype>#include <cmath>#include <cstdio>#include <cstdlib>#include <cstring>

2015-11-16 22:40:16 430

原创 CF 593D

有一棵树,每条边有一个值,要求支持两种操作:1. 一条边 pi 的值有 xpi 改为 c , c 可以发现: y 最终的值和除法的顺序无关, 那么答案就是 y / Π xi,到这里就可以发现这题可以用树链剖分做了,遇到爆 LL 的时候特殊处理下就好了。但是,我们会发现题目给的条件有一个没用上,就是 c 1的边之后,y就变为0了, 那么实际上每次询问最多需要对权值>1的边做除法64次就够

2015-11-06 12:59:13 437

原创 USACO Section 2.1

好久没补坑了, 擦...The Castle城堡里有一些房间, 问房间数,最大的房间, 拆掉一面墙后最大的房间, 拆哪个墙。简单的地图处理和dfs#include using namespace std;int w[55][55][4];int c[55][55];int v[10000];int dx[] = {0, -1, 0, 1}, dy[] = {-1, 0

2015-10-15 08:37:51 311

原创 HDU 5493 Queue (合肥网络赛 1010 )

题目链接题意,一共有 N 个人,每个人的身高都不同,  知道其中每个人的高度 h 以及在他前面或者后面有 k 个人比他高, 问原先的队列, 如果有多种站法, 求按身高字典序最小的。做法,因为每个人的身高不同, 所以我们先将问题简化, 假设 N 个人的身高分别是 1, 2, 3 ... N 。 然后我们倒过来将人插到原先站好的序列中还原原序列。假设当前还原到身高为 N - 2 的这个人,

2015-09-27 20:56:07 335

原创 HDU 5489 Removed Interval (合肥网络赛 1006 )

题目链接题意, 给一串字符串, 问删掉一段 L 长度的子串之后, 剩下的串的 LIS 最大长度。做法,首先先用 O(n lg n) 的方法二分求出原串的 LIS, 然后用 dp 求出一段子串中间去掉 L 长度后的 LIS。用 LIS { Str } 表示串 Str 的 LIS, S [ l, r ]  表示子串 S(l ~ r)则转移方程可以表示为: dp[i] = max( LI

2015-09-27 20:36:03 963

原创 我选择死亡

擦。

2015-09-20 20:04:33 444

原创 USACO Section 1.5

第一章最后一部分了,后面的大概要开始变得更难了。Nunber Triangles经典的 dp 题, 可以用记忆化搜索也可以用递推, 我用的是记忆化搜索。#include using namespace std;const int N = 1005;int f[N][N], n, a[N][N];int get(int r, int c) { if (r ==

2015-09-17 12:13:41 240

转载 [模版] 位运算 转自USACO

a |= 0x20; /* turn on bit 0x20 */a &= ~0x20; /* turn off bit 0x20 */a ^= 0x20; /* toggle bit 0x20 */if (a & 0x20) { /* then the 0x20 bit is on */} BinaryValue Sample

2015-09-17 10:02:47 266

原创 USACO Section 1.4 More Search Technique

Orz, 感觉题已经慢慢开始变难了, 快要刷不动过了...  不知道我还能坚持刷多久。Arithmetic Progressions题意:一个可以表示为两个完全平方数相加的数被称为 bisquares (双平方数?), 给定底数的上限, 求这些底数两两构成的 bisquares 的集合中能构成项数为 n 的等差数列有哪些,要求输出首项和项数。由于是搜索专题, 就以为是搜索题(其

2015-09-16 20:27:59 212

原创 USACO Section 1.3 Problems rest

Section 1.3 中除了分类的贪心,还有另外几道题, 不过并没有把这几道题贴上tags。我感觉这几道题更像简单的暴力和搜索,大概是复习之前所学知识吧。Prime Cryptarithm题目给出了一个三位数×两位数的竖式: * * * x * * ------- * * * <-- partial produ

2015-09-15 23:43:43 297

原创 USACO Section 1.3 Greedy Algorithm

两道贪心题, 刷水题完全没有成就感, 更不用说刷水题还一直wa了  OrzMixing Milk按照农夫提供的牛奶价格 sort一遍农夫, 贪心#include using namespace std;struct Farmer { int p, w; void read() { scanf("%d %d", &p, &w); }

2015-09-15 15:57:07 322

原创 USACO Section 1.2 Complete Search

现在开始找机会慢慢刷USACO, 第一个专题 complete search, 差不多就是暴力乱搞 ~很多题都没有1A,这再次证明了我还太弱,以后还得多加努力啊 !1. Milking Cows做法: sort一遍, 合并重叠部分, 很水~#include using namespace std;struct node { int s, t; voi

2015-09-15 01:14:10 254

原创 HDU 5439. Aggregated Counting (2015长春网络赛C题)

题目链接赛后看了下别人的讨论恍然大悟。这题比赛的时候一直纠结着1e9的预处理会爆内存已经1e9的即时查询会tle。毕竟还是Too naive, 觉得数列题就只能有通项式, 或者是递推预处理, 完全没有想到预处理中间的过程采用公式能够大量节省时间以及空间Orz….做法,首先这道题answer序列为 1, 5, 11, 23, 38, 62, 90… 经过找规律我们能发现ans[i] = Σ a[j]

2015-09-13 18:45:27 378

原创 Ural 1519. Formula 1 ------ 插头dp

题目链接学习插头dp差不多也有段时间了, 最开始水的一道题是Eat the tree, 多回路类型的插头dp。那时候看了cdq的《基于连通性状态压缩的动态规划问题》以及各路大神的blog, 然而对于插头dp仍是一头雾水, 虽然对于大神们来说插头dp还是挺水的, 但是我还是花了很长时间才最终看懂了那些位运算代表的含义。这道题正好是cdq论文中的例题, 方法在论文中也说得比较明确了, 这里我来说说我对于

2015-09-13 02:06:42 404

原创 HDU 1754

题目: I Hate ItTime Limit: 9000/3000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 46430    Accepted Submission(s): 18212  Problem Descr

2015-05-19 16:37:05 190

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除