自定义博客皮肤VIP专享

*博客头图:

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

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

博客底图:

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

栏目图:

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

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

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

原创 2018牛客多校第4场——Ternary string(欧拉降幂)

题意:给你一个三进制串,每一秒每个2后面会多出一个1,每个1后会多出一个0,同时串首的字符被抹去,问多少秒后这个串会被完全消去。思路:赛场上不会欧拉降幂,下来补的。 首先,这种题肯定是有规律的。对于这道题,很容易想到,一个数以及他衍生出来的数要全部消去一定和他存在的时间有关,那么暴力模拟一下,跑一下01,001,0001……,02,002,0002……这些数据,就会发现规律。...

2018-07-31 17:20:34 352

原创 HUD3954-Level up(线段树技巧)

题目大意:有N个英雄,初始为1级,0经验。有M波怪物,每波怪物选择区间[l,r]的英雄去打,打死每波怪物的英雄会获得k(等级)*ei的经验,现在给出升到每个等级所需要的经验,和每波怪物派出的英雄,每次询问一个区间内经验值最高的值。思路:一道线段树区间更新变形题,容易想到每次更新对每个子区间的改变是不同的,但是,对答案的英雄却是唯一的,假设一个区间的最大等级为lv,那么更新当v前区间...

2018-07-28 11:52:41 235

原创 SPOJ-DQUERY - D-query(主席数,区间不同元素个数)

题意:多次询问一段区间中不同元素的个数 思路:主席树入门题,建N棵线段树,每颗记录区间[1,n]区间中每个元素最后出现的位置。查询的时候直接相减。#include <stdio.h>#include <algorithm>using namespace std;const int maxn=1e5+100;int a[maxn],root[maxn],f[...

2018-07-08 16:46:09 372

原创 SPOJ3273——ORDERSET - Order statistic set(Treap)

In this problem, you have to maintain a dynamic set of numbers which support the two fundamental operationsINSERT(S,x): if x is not in S, insert x into S DELETE(S,x): if x is in S, delete x from S ...

2018-05-04 17:28:19 210

原创 POJ2892——Tunnel Warfare(Treap)

Tunnel Warfare Time Limit: 1000MS Memory Limit: 131072K Total Submissions: 9165 Accepted: 3786 DescriptionDuring the War of Resistance Against Japan, tunnel warfare was carried out exten...

2018-05-04 17:17:27 201

原创 hihocoder1325-平衡树·Treap

描述 小Ho:小Hi,我发现我们以前讲过的两个数据结构特别相似。小Hi:你说的是哪两个啊?小Ho:就是二叉排序树和堆啊,你看这两种数据结构都是构造了一个二叉树,一个节点有一个父亲和两个儿子。 如果用1..n的数组来存储的话,对于二叉树上的一个编号为k的节点,其父亲节点刚好是k/2。并且它的两个儿子节点分别为k*2和k*2+1,计算起来非常方便呢。小Hi:没错,但是小Hi你知道有一种办...

2018-05-03 19:10:54 152

原创 POJ1442——Black Box(Treap)

Black Box Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 14319 Accepted: 5848 DescriptionOur Black Box represents a primitive database. It can save an integer array and ha...

2018-05-03 16:53:29 210

原创 POJ2985-The k-th Largest Group(Treap + 并查集)

The k-th Largest Group Time Limit: 2000MS Memory Limit: 131072K Total Submissions: 9639 Accepted: 3142 DescriptionNewman likes playing with cats. He possesses lots of cats in his home. B...

2018-05-03 16:09:57 253

原创 Tinkoff Internship Warmup Round 2018 and Codeforces Round #475 (Div. 2) C.Alternating Sum

题目;这里写链接内容 题意:求 这里si是给定的一串正负号组成的字符,表示1~k项的符号,n+1可以整除k,即所求数列的符号是k循环的,a[i]=a[i+k]。 思路:由题意,很明显,这是一个等比数列,先用快速幂求出前k项的和a1,即等比数列的首项,n+1/k即是长度,套用等比数列求和公式即可。要用到逆元。#include <stdio.h>#include <a...

2018-05-02 21:34:02 252

原创 POJ 2888-Magic Bracelet(polya计数定理)

Magic Bracelet Time Limit: 2000MS Memory Limit: 131072K Total Submissions: 6024 Accepted: 1922 DescriptionGinny’s birthday is coming soon. Harry Potter is preparing a birthday present for h

2018-03-22 17:04:35 477

原创 BZOJ2120-数颜色(带修改莫队)

2120: 数颜色 Time Limit: 6 Sec Memory Limit: 259 MB Submit: 7556 Solved: 3071 [Submit][Status][Discuss] Description 墨墨购买了一套N支彩色画笔(其中有些颜色可能相同),摆成一排,你需要回答墨墨的提问。墨墨会像你发布如下指令: 1、 Q L R代表询问你从第L支画笔到第R支画笔中

2018-03-16 15:31:00 178

原创 HDU4638-Group (莫队模板)

There are n men ,every man has an ID(1..n).their ID is unique. Whose ID is i and i-1 are friends, Whose ID is i and i+1 are friends. These n men stand in line. Now we select an interval of men to make

2018-03-16 15:20:17 300

原创 Codeforces Round #469 (Div. 2)D. A Leapfrog in the Array(递推)

D. A Leapfrog in the Array time limit per test2 seconds memory limit per test512 megabytes inputstandard input outputstandard output Dima is a beginner programmer. During his working process, he r

2018-03-10 10:01:33 208

原创 Codeforces Round #469 (Div. 2)C. Zebras(贪心)

C. Zebras time limit per test1 second memory limit per test512 megabytes inputstandard input outputstandard output Oleg writes down the history of the days he lived. For each day he decides if it

2018-03-10 09:44:58 219

原创 Codeforces Round #469 (Div. 2)B. Intercepted Message

B. Intercepted Message time limit per test1 second memory limit per test512 megabytes inputstandard input outputstandard output Hacker Zhorik wants to decipher two secret messages he intercepted y

2018-03-10 09:25:29 209

原创 Codeforces Round #461 (Div. 2) D. Robot Vacuum Cleaner(sort)

D. Robot Vacuum Cleaner time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Pushok the dog has been chasing Imp for a few hours already.Fortuna

2018-02-26 20:19:22 191

原创 Codeforces Round #461 (Div. 2) C. Cave Painting(暴力)

C. Cave Painting time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Imp is watching a documentary about cave painting.Some numbers, carved ...

2018-02-26 20:07:29 158

原创 Codeforces Round #461 (Div. 2) B. Magic Forest(DFS)

B. Magic Forest time limit per test1 second memory limit per test256 megabytes inputstandard input outputstandard output Imp is in a magic forest, where xorangles grow (wut?)A xorangle of order n

2018-02-26 19:57:38 139

原创 HDU6047-Maximum Sequence(单调队列)

Maximum SequenceSteph is extremely obsessed with “sequence problems” that are usually seen on magazines: Given the sequence 11, 23, 30, 35, what is the next number? Steph always finds them too easy for such a

2018-02-02 17:17:14 237

原创 POJ2891-Strange Way to Express Integers(同余方程求解)

Strange Way to Express Integers Elina is reading a book written by Rujia Liu, which introduces a strange way to express non-negative integers. The way is described as following:Choose k different positive int

2018-02-01 20:58:57 199

原创 HDU1828-Picture(扫描线求周长)

HDU 1828 PictureA number of rectangular posters, photographs and other pictures of the same shape are pasted on a wall. Their sides are all vertical or horizontal. Each rectangle can be partially or totally c

2018-02-01 19:30:01 215

原创 Codeforces Round #460 (Div. 2)-D Substring(Tarjian+记忆化搜索)

D. Substring You are given a graph with n nodes and m directed edges. One lowercase letter is assigned to each node. We define a path's value as the number of the most frequently occurring letter. For example,

2018-02-01 10:18:32 207

原创 HDU1255-覆盖的面积(扫描线求面积并)

覆盖的面积Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others) Total Submission(s): 6599 Accepted Submission(s): 3366Problem Description 给定平面上若干矩形,求出被这些矩形覆盖过至少两次的区域

2018-01-30 20:33:56 255

原创 HDU4122-Alice's mooncake shop(单调队列)

The Mid-Autumn Festival, also known as the Moon Festival or Zhongqiu Festival is a popular harvest festival celebrated by Chinese people, dating back over 3,000 years to moon worship in China's Shang Dynasty. T

2018-01-29 16:30:51 176

原创 HDU1542-Atlantis(扫描线+离散化个人小结)

There are several ancient Greek texts that contain descriptions of the fabled island Atlantis. Some of these texts even include maps of parts of the island. But unfortunately, these maps describe different regi

2018-01-29 15:32:51 295

原创 POJ2154-Color(Polya+欧拉函数优化)

Color Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 11077 Accepted: 3589 DescriptionBeads of N colors are connected together into a circular necklace of N beads (NYou o

2018-01-25 19:51:40 236

原创 POJ1286-Necklace of Beads(Polya模板题)

Necklace of Beads Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 8930 Accepted: 3709 DescriptionBeads of red, blue or green colors are connected together into a circular neck

2018-01-25 14:03:54 183

原创 POJ2689-Prime Distance(区间素筛)

Prime Distance Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 20161 Accepted: 5424 DescriptionThe branch of mathematics called number theory is about properties of numbers

2018-01-22 21:14:50 200

原创 POJ1904-King's Quest(思维+强连通缩点)

King’s Quest Time Limit: 15000MS Memory Limit: 65536K Total Submissions: 9590 Accepted: 3551 Case Time Limit: 2000MS DescriptionOnce upon a time there lived a king and he had N sons. And

2018-01-21 22:28:54 293

原创 POJ2142-The Balance(拓展欧几里得+个人小结)

The Balance Time Limit: 5000MS Memory Limit: 65536K Total Submissions: 7661 Accepted: 3368 DescriptionMs. Iyo Kiffa-Australis has a balance and only two kinds of weights to measure a dos

2018-01-21 20:59:55 195

原创 HDU2586-How far away ?(LCA)

How far away ?Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 19536 Accepted Submission(s): 7661Problem Description There are n houses

2018-01-18 21:08:28 192

原创 POJ3160-Father Christmas flymouse (强连通缩点+dfs)

Father Christmas flymouse Time Limit: 1000MS Memory Limit: 131072K Total Submissions: 3764 Accepted: 1245 DescriptionAfter retirement as contestant from WHU ACM Team, flymouse volunteere

2018-01-18 20:54:47 256

原创 HDU2767-Proving Equivalences(强连通+缩点+DGA性质)--Tarjan模板

Consider the following exercise, found in a generic linear algebra textbook. Let A be an n × n matrix. Prove that the following statements are equivalent: A is invertible. Ax = b has exactly one

2018-01-18 20:44:03 234

原创 POJ3228- Gold Transportation (并查集+kruskal)

 Gold TransportationTime Limit: 2000MS   Memory Limit: 65536K Total Submissions: 3547   Accepted: 1262  DescriptionRecently, a number of gold mines have been discovered in Zorr...

2018-01-18 20:29:13 226

原创 POJ1751-Highways(最小生成树+并查集)

Highways Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 17777 Accepted: 5213 Special Judge DescriptionThe island nation of Flatopia is perfectly flat. Unfortunately,

2018-01-18 19:47:27 214

原创 HDU1281-棋盘游戏(二分匹配)

Problem Description小希和Gardon在玩一个游戏:对一个N*M的棋盘,在格子里放尽量多的一些国际象棋里面的“车”,并且使得他们不能互相攻击,这当然很简单,但是Gardon限制了只有某些格子才可以放,小希还是很轻松的解决了这个问题(见下图)注意不能放车的地方不影响车的互相攻击。 所以现在Gardon想让小希来解决一个更难的问题,在保证尽量多的“车”的前提下,棋盘里有些

2018-01-18 19:31:53 163

原创 POJ2060-Taxi Cab Scheme (最小路径覆盖)

Running a taxi station is not all that simple. Apart from the obvious demand for a centralised coordination of the cabs in order to pick up the customers calling to get a cab as soon as possible, ther

2018-01-18 19:14:43 550

原创 HDU4185-Oil Skimming(二分匹配,匈牙利模板)

Thanks to a certain “green” resources company, there is a new profitable industry of oil skimming. There are large slicks of crude oil floating in the Gulf of Mexico just waiting to be scooped up by e

2018-01-17 20:54:44 259

原创 HDU5040-Instrusive (优先队列+BFS)

The legendary mercenary Solid Matt gets a classic mission: infiltrate a military base. The military base can be seen as an N * N grid. Matt’s target is in one of the grids and Matt is now in another

2018-01-17 20:43:44 256

原创 最优比例生成树-Desert King(0-1分数规划)

 David the Great has just become the king of a desert country. To win the respect of his people, he decided to build channels all over his country to bring water to every village. Villages which are...

2018-01-16 21:09:40 308

空空如也

空空如也

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

TA关注的人

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