自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+

Ellery的book

我有梦想啊!

  • 博客(131)
  • 收藏
  • 关注

原创 ellery此博客暂时停用

这是新博客地址:https://www.cnblogs.com/ellery/csdn广告太烦,但是手机端蛮好用的

2019-09-26 16:03:34 234

原创 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 164

原创 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 456

原创 转主席树代码

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 112

原创 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 117

原创 bzoj 2152: 聪聪可可(树分治)

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

2019-09-22 20:41:54 128

原创 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 83

原创 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 147 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 158

原创 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 113

原创 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 115

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

求在小于等于N的正整数中有多少个X满足:X mod a[0] = b[0], X mod a[1] = b[1], X mod a[2] = b[2], …, X mod a[i] = b[i], … (0 < a[i] <= 10)。 Input输入数据的第一行为一个正整数T,表示有T组测试数据。每组测试数据的第一行为两个正整数N,M (0 < N <= 1000...

2019-09-18 11:46:03 155

原创 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 155

原创 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 77

原创 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 203

原创 (转)HDU - 5493 Queue

题目大意:有 N 个人排队,每个人都忘记自己的位置。但是每个人都知道自己的身高 Hi 和自己前边或后边有 Ki 个比自己高的人。给你每个人的 Hi,Ki,求按身高满足最小序的情况。如果不满足最小序的情况,则输出"impossible"。解题思路:题目要求输出身高字典序最小的情况,那么先对身高按从小到大排序。然后按身高从小到大确定每个人的位置。由于每次都是从小到大,则每次放进的人都是比之...

2019-09-10 18:24:40 90

原创 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 165

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

很久很久以前,在遥远的大陆上有一个美丽的国家。统治着这个美丽国家的国王是一个园艺爱好者,在他的皇家花园里种植着各种奇花异草。有一天国王漫步在花园里,若有所思,他问一个园丁道: “最近我在思索一个问题,如果我们把花坛摆成六个六角形,那么……” “那么本质上它是一个深度优先搜索,陛下”,园丁深深地向国王鞠了一躬。 “嗯……我听说有一种怪物叫九头蛇,它非常贪吃苹果树……” “是的,显然这是一道经典的动态...

2019-09-07 00:58:11 100

原创 敌兵布阵(CDQ分治模板题)

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

2019-09-06 21:56:29 226

原创 陌上花开 HYSBZ - 3262(三维偏序CDQ分治)(模板)

有n朵花,每朵花有三个属性:花形(s)、颜色©、气味(m),用三个整数表示。现在要对每朵花评级,一朵花的级别是它拥有的美丽能超过的花的数量。定义一朵花A比另一朵花B要美丽,当且仅Sa>=Sb,Ca>=Cb,Ma>=Mb。显然,两朵花可能有同样的属性。需要统计出评出每个等级的花的数量。Input第一行为N,K (1 <= N <= 100,000, 1 &lt...

2019-09-06 21:52:35 115

原创 大数模板

大数减法模板#include<iostream>#include<cstring>#include<cstdlib>#define maxn 1000using namespace std;int a[maxn], b[maxn];bool myStrcmp(const char str1[], const char str2[]){ ...

2019-09-05 22:25:58 80

原创 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 102

原创 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 103

原创 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 174

原创 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 73

原创 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 108

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

**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 208 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 140

原创 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 230 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 157

原创 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 89

原创 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 172

原创 HDU - 1255(扫描线)(离散化)

给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域的面积.Input输入数据的第一行是一个正整数T(1<=T<=100),代表测试数据的数量.每个测试数据的第一行是一个正整数N(1<=N<=1000),代表矩形的数量,然后是N行数据,每一行包含四个浮点数,代表平面上的一个矩形的左上角坐标和右下角坐标,矩形的上下边和X轴平行,左右边和Y轴平行.坐标的范围从0到100...

2019-08-21 16:58:48 107

原创 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 124

原创 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 110

原创 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 143

原创 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 111

原创 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 109 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 236

原创 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 85 4

空空如也

空空如也

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

TA关注的人

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