Description
Let A1, A2, ... , AN be N elements. You need to deal with two kinds of operations. One type of operation is to add a given number to a few numbers in a given interval. The other is to q...
分类:
编程语言 时间:
2014-10-18 16:59:56
阅读次数:
321
URAL 1707. Hypnotoad's Secret
题目链接
题意:这题设置的恶心不能多说,构造点和矩形,大概就是问每个矩形里面是否包含点
思路:树状数组,把点排序,按y轴,在按x轴,在按询问,这样每次遇到一个点就在相应的扫描线上加,遇到查询就询问出左边到这个点位置的,就能预处理出每个点左下角包含的点的个数,然后每个矩形再利用容斥原理去搞一下即可
代码:
#i...
分类:
编程语言 时间:
2014-10-17 22:00:18
阅读次数:
379
大意:告诉你一个有n个数的序列 (1 -- n) 问其中有多少组 (a[i], a[j], a[k]) 满足i 2 #include 3 #include 4 using namespace std; 5 6 const long long maxn = 100005; 7 const lo...
分类:
编程语言 时间:
2014-10-17 20:16:50
阅读次数:
208
Inner Vertices
Time Limit: 5000MS
Memory Limit: 65536K
Total Submissions: 1692
Accepted: 446
Case Time Limit: 2000MS
Description
There is an infinite square grid...
分类:
编程语言 时间:
2014-10-17 15:36:06
阅读次数:
228
状态压缩dp+spfa解斯坦纳树
枚举子树的形态 dp[i][j] = min(dp[i][j], dp[i][k]+dp[i][l]) 其中k和l是对j的一个划分
按照边进行松弛
dp[i][j] = min(dp[i][j], dp[i'][j]+w[i][j])其中i和i'之间有边相连
#include
#include
#include
using name...
分类:
编程语言 时间:
2014-10-17 11:57:51
阅读次数:
235
题目链接:hdu 3966 Aragorn's Story
题目大意:给定一个棵树,然后三种操作
Q x:查询节点x的值I x y w:节点x到y这条路径上所有节点的值增加wD x y w:节点x到y这条路径上所有节点的值减少w
解题思路:树链剖分,用树状数组维护每个节点的值。
#pragma comment(linker, "/STACK:1024000000,1024000...
分类:
编程语言 时间:
2014-10-17 10:19:10
阅读次数:
225
题意:自行脑补
做法:直接开权值那么多的二维树状数组暴力。
Code:
#include
#include
#include
#include
using namespace std;
inline int getc() {
static const int L = 1 << 15;
static char buf[L], *S = buf, *T = buf;...
分类:
Web程序 时间:
2014-10-17 10:17:17
阅读次数:
241
POJ 3928 & HDU 2492 Ping pong(树状数组求逆序数)...
分类:
编程语言 时间:
2014-10-17 00:02:23
阅读次数:
261