*博客头图：

RGB颜色，例如：#AFAFAF

Hover：

RGB颜色，例如：#AFAFAF

RGB颜色，例如：#AFAFAF

# Ellery的book

• 博客(131)
• 论坛 (2)
• 收藏
• 关注

#### 原创 ellery此博客暂时停用

2019-09-26 16:03:34 91

#### 原创 Codeforces 161D Distance in Tree(树的点分治)

A tree is a connected graph that doesn’t contain any cycles.The distance between two vertices of a tree is the length (in edges) of the shortest path between these vertices.You are given a tree with...

2019-09-25 17:24:14 80

#### 原创 Destiny CodeForces - 840D（主席树）

Once, Leha found in the left pocket an array consisting of n integers, and in the right pocket q queries of the form l r k. If there are queries, then they must be answered. Answer for the query is mi...

2019-09-24 14:50:33 131

#### 原创 转主席树代码

1 #include<cstdio> 2 #include<algorithm> 3 using namespace std; 4 const int N=2e5+10; 5 const int M=N*10; 6 struct President_Tree{ 7 int L,R,sum; 8 }T[M<<1]; 9 int last[...

2019-09-23 19:32:40 52

#### 原创 Fish eating fruit 点分治

#include<iostream>#include<cstdio>#include<algorithm>#include<cstring>using namespace std;#define rep(a,b,c) for(int a=b;a<=c;a++)void _swap(int &x,int &y){x^...

2019-09-22 21:34:57 55

#### 原创 bzoj 2152: 聪聪可可（树分治）

2152: 聪聪可可Time Limit: 3 Sec Memory Limit: 259 MBSubmit: 5933 Solved: 3156[Submit][Status][Discuss]Description聪聪和可可是兄弟俩，他们俩经常为了一些琐事打起来，例如家中只剩下最后一根冰棍而两人都想吃、两个人都想玩儿电脑（可是他们家只有一台电脑）……遇到这种问题，一般情况下石头剪...

2019-09-22 20:41:54 42

#### 原创 Tree POJ - 1741（树分治模板）

Give a tree with n vertices,each edge has a length(positive integer less than 1001).Define dist(u,v)=The min distance between node u and v.Give an integer k,for every pair (u,v) of vertices is calle...

2019-09-22 18:35:45 28

#### 原创 Codeforces343D(SummerTrainingDay06-F dfs序+线段树)

#include<iostream>#include<vector>using namespace std;vector<int> G[500009];int in[500009],out[500009],father[500009];int tot,f;struct ndoe{ int l,r,lazy,c,v; #define l(x) ...

2019-09-21 17:04:45 46 1

#### 原创 米勒罗宾素数检测模板

#include <iostream>#include <cstdio>#include <cstdlib>#include <algorithm>#define LL unsigned long long//注意这个longlong的定义，必须有 unsigned using namespace std;//米勒 罗宾算法模版 ==...

2019-09-20 20:56:51 61

#### 原创 Minimum Inversion Number HDU - 1394（树状数组/权值线段树求逆序对）

The inversion number of a given number sequence a1, a2, …, an is the number of pairs (ai, aj) that satisfy i < j and ai > aj.For a given sequence of numbers a1, a2, …, an, if we move the first ...

2019-09-19 17:00:24 23

#### 原创 bzoj1101 （莫比乌斯反演+整除分块+输入挂标准模板）

FGD正在破解一段密码，他需要回答很多类似的问题：对于给定的整数a,b和d，有多少正整数对x,y，满足x<=a，y<=b，并且gcd(x,y)=d。作为FGD的同学，FGD希望得到你的帮助。Input第一行包含一个正整数n，表示一共有n组询问。（1<=n<= 50000）接下来n行，每行表示一个询问，每行三个正整数，分别为a,b,d。（1<=d<=a,b...

2019-09-18 22:14:10 35

#### 原创 X问题 HDU - 1573(中国剩余定理水题)

2019-09-18 11:46:03 38

#### 原创 Hello Kiki HDU - 3579（扩展中国剩余定理）

One day I was shopping in the supermarket. There was a cashier counting coins seriously when a little kid running and singing "门前大桥下游过一群鸭，快来快来 数一数，二四六七八". And then the cashier put the counted coins b...

2019-09-18 11:29:18 56

#### 原创 poj2891 中国剩余定理标准模板

#include <stdio.h>#include <string.h>#include <algorithm>#include <iostream>#include <stdlib.h>#include <math.h>using namespace std;typedef long long LL;con...

2019-09-17 15:19:18 31

#### 原创 Oulipo POJ - 3461 （kmp模板）

The French author Georges Perec (1936–1982) once wrote a book, La disparition, without the letter 'e'. He was a member of the Oulipo group. A quote from the book: Tout avait Pair normal, mais tou...

2019-09-12 13:38:24 79

#### 原创 （转）HDU - 5493 Queue

2019-09-10 18:24:40 41

#### 原创 2019徐州网络赛B so easy（tr1:unordered_map）

|so easyThere are nnn points in an array with index from 111 to nnn, and there are two operations to those points.1: 1 x1 \ x1 x marking the point xxx is not available2: 2 x2 \ x2 x query for the ...

2019-09-07 19:50:10 62

#### 原创 Tree 园丁的烦恼 HYSBZ - 1935(CDQ分治模板)

2019-09-07 00:58:11 40

#### 原创 敌兵布阵（CDQ分治模板题）

C国的死对头A国这段时间正在进行军事演习，所以C国间谍头子Derek和他手下Tidy又开始忙乎了。A国在海岸线沿直线布置了N个工兵营地,Derek和Tidy的任务就是要监视这些工兵营地的活动情况。由于采取了某种先进的监测手段，所以每个工兵营地的人数C国都掌握的一清二楚,每个工兵营地的人数都有可能发生变动，可能增加或减少若干人手,但这些都逃不过C国的监视。中央情报局要研究敌人究竟演习什么战术,所以...

2019-09-06 21:56:29 78

#### 原创 陌上花开 HYSBZ - 3262（三维偏序CDQ分治）（模板）

2019-09-06 21:52:35 43

#### 原创 大数模板

2019-09-05 22:25:58 21

#### 原创 Super Mario HDU - 4417（主席树）（求小于k的多少个）

Mario is world-famous plumber. His “burly” figure and amazing jumping ability reminded in our memory. Now the poor princess is in trouble again and Mario needs to save his lover. We regard the road to...

2019-09-05 03:11:46 42

#### 原创 Kth number HDU - 2665 （主席树）（模板）

Give you a sequence and ask you the kth big number of a inteval.InputThe first line is the number of the test cases.For each test case, the first line contain two integer n and m (n, m <= 100000...

2019-09-05 01:07:57 48

#### 原创 2018 宁夏邀请赛 Moving On Gym - 102222F（深入理解三维floyd）

Firdaws and Fatinah are living in a country with n cities, numbered from 1 to n. Each city has a risk of kidnapping or robbery.Firdaws’s home locates in the city u, and Fatinah’s home locates in th...

2019-09-01 21:01:01 59

#### 原创 spfa(long long)标准模板

#include#include<stdio.h>#include#include#include<string.h>using namespace std;typedef long long ll;int n,m,s;#define maxn 605ll edge[maxn];int tot,head[maxn];int vis[maxn],ver[...

2019-09-01 18:38:10 27

#### 原创 lazy线段树模板

#include<iostream>#include<algorithm>#include<math.h>#include<stdio.h>using namespace std;typedef long long ll;struct segmenttree{ int l;int r; ll sum;ll add; #define...

2019-08-28 16:42:22 35

#### 原创 暑假训练第一周限时训练二

**HDU - 2674 **WhereIsHeroFrom: Zty, what are you doing ?Zty: I want to calculate N!..WhereIsHeroFrom: So easy! How big N is ?Zty: ...

2019-08-28 11:14:46 90 2

#### 原创 暑假限时训练一题目整理

Phalanx–hdu2859Today is army day, but the servicemen are busy with the phalanx for the celebration of the 60th anniversary of the PRC.A phalanx is a matrix of size nn, each element is a character (a...

2019-08-28 10:45:11 47

#### 原创 Lost Cows POJ - 2182(找规律)（别问咋找的，我自己也不知道！）

N (2 <= N <= 8,000) cows have unique brands in the range 1…N. In a spectacular display of poor judgment, they visited the neighborhood ‘watering hole’ and drank a few too many beers before dinne...

2019-08-25 18:54:48 57 2

#### 原创 L - Monitor HDU - 6514(二维差分)（二维前缀和）（动态开二维数组）

Xiaoteng has a large area of land for growing crops, and the land can be seen as a rectangle of n×m.But recently Xiaoteng found that his crops were often stolen by a group of people, so he decided t...

2019-08-22 18:01:07 49

#### 原创 Tallest Cow POJ - 3263（差分）（pair）

FJ’s N (1 ≤ N ≤ 10,000) cows conveniently indexed 1…N are standing in a line. Each cow has a positive integer height (which is a bit of secret). You are told only the height H (1 ≤ H ≤ 1,000,000) of t...

2019-08-22 15:45:09 25

#### 原创 H - New Year Tree CodeForces - 620E（64位状压）(dfs序)（线段树）（lazy）

#include<iostream> #include<sstream> #include<algorithm> #include<cstdio> #include<string.h> #include<cctype> #include<string> #in...

2019-08-22 14:22:25 109

#### 原创 HDU - 1255（扫描线）（离散化）

2019-08-21 16:58:48 32

#### 原创 C - Can you answer these queries III(SPOJ-GSS3) (线段树区间更新)

You are given a sequence A of N (N <= 50000) integers between -10000 and 10000. On this sequence you have to apply M (M <= 50000) operations:modify the i-th element in the sequence or for given...

2019-08-19 16:34:24 52

#### 原创 Tunnel Warfare(hdu1540) (线段树区间合并)（模板）

During the War of Resistance Against Japan, tunnel warfare was carried out extensively in the vast areas of north China Plain. Generally speaking, villages connected by tunnels lay in a line. Except t...

2019-08-18 21:23:10 41

#### 原创 D - Y HDU - 4705(树形dp)（数学知识）（容斥）

Input41 21 31 4Output1HintThe only set is {2,3,4}.Please use #pragma comment(linker, “/STACK:16777216”)Sample Input41 21 31 4Sample Output1HintThe only set is {2,3,4}.Ple...

2019-08-17 16:05:04 46

#### 原创 F - Mondriaan's Dream POJ - 2411（状压dp）（暴力）

Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings in his ‘toilet series’ (where he had to use his toilet paper to draw on, for all of h...

2019-08-16 20:52:56 39

#### 原创 SPOJ - BALNUM Balanced Numbers(状压)（数位dp）

Balanced numbers have been used by mathematicians for centuries. A positive integer is considered a balanced number if: Every even digit appears an odd number of times in its decimal representation...

2019-08-15 13:07:17 31 1

#### 原创 HDU - 2809 God of War （暴力状压dp）（模拟）

At 184~280 A.D ,there were many kingdoms in China. Three strongest among them are “Wei”, “Shu”, “Wu”. People call this period as “Three Kingdoms”.HH is a super “Three Kingdoms” fan, because at this p...

2019-08-14 19:29:24 163

#### 原创 hdu3709 Balanced Number（数位dp）（暴力）（负数状态处理）

A balanced number is a non-negative integer that can be balanced if a pivot is placed at some digit. More specifically, imagine each digit as a box with weight indicated by the digit. When a pivot is ...

2019-08-14 13:25:26 39 4

###### 空空如也

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

TA关注的人 TA的粉丝