——算法技巧——
文章平均质量分 82
LP_Cong
Python, Qt C++ Developer ACMer https://github.com/Linzecong
展开
-
hihoCoder - 1878 Palindromes (找规律)(2018ICPC北京I)
时间限制:1000ms单点时限:1000ms内存限制:512MB描述Recently, Nvoenewr learnt palindromes in his class.A palindrome is a nonnegative integer that is the same when read from left to right and when read from ri...原创 2018-11-12 19:43:45 · 735 阅读 · 0 评论 -
HYSBZ - 3262 陌上花开(CDQ分治)
3262: 陌上花开Time Limit: 20 Sec Memory Limit: 256 MBSubmit: 3351 Solved: 1560[Submit][Status][Discuss]Description有n朵花,每朵花有三个属性:花形(s)、颜色(c)、气味(m),用三个整数表示。现在要对每朵花评级,一朵花的级别是它拥有的美丽能超过的花的数量。定义一朵花A比另一朵花B要美丽,...原创 2018-04-18 14:08:08 · 343 阅读 · 0 评论 -
HDU - 1166 敌兵布阵 (CDQ分治解法)
这道题线段树,树状数组,带修改莫队都能解,这里用CDQ分治解,当做学习CDQ分治!CDQ分治刚开始学可能会有点困难,但是当你做题的时候,再去体会,就会有感觉了。最主要来说,CDQ还是拿来降维用的,很多篇博客都有谈到,实际上,求逆序数的分治解法,就是CDQ分治的核心问题。分治分成左右两个区间的时候,左边的区间是如何影响右边区间的,只要我们把这个问题解决,那么就可以用CDQ分治解决。比如这道题,我们把...原创 2018-04-18 14:01:01 · 284 阅读 · 0 评论 -
【WC2013】糖果公园 (树上带修改莫队)
Candyland 有一座糖果公园,公园里不仅有美丽的风景、好玩的游乐项目,还有许多免费糖果的发放点,这引来了许多贪吃的小朋友来糖果公园玩。糖果公园的结构十分奇特,它由 nn 个游览点构成,每个游览点都有一个糖果发放处,我们可以依次将游览点编号为 11 至 nn。有 n−1n−1 条双向道路连接着这些游览点,并且整个糖果公园都是连通的,即从任何一个游览点出发都可以通过这些道路到达公园里的所有其它游...原创 2018-04-16 22:15:18 · 481 阅读 · 0 评论 -
HYSBZ 2038 小Z的袜子 莫队算法
保存下莫队模板,原理太容易懂了……慢慢学习!#include <bits/stdc++.h>using namespace std;typedef long long ll;const int MAXN = 200005;ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; }struct query{ int l; i...原创 2018-04-16 14:40:06 · 205 阅读 · 0 评论 -
CodeForces - 954G Castle Defense (二分+尺取法思想)
Castle Defensetime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputToday you are going to lead a group of elven archers to defend the castle that is ...原创 2018-03-27 21:49:23 · 668 阅读 · 0 评论 -
CodeForces - 924C Riverside Curio (思维)
Riverside Curiotime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputArkady decides to observe a river for n consecutive days. The river's water level on...原创 2018-03-26 19:33:42 · 612 阅读 · 0 评论 -
“景驰科技杯”2018年华南理工大学程序设计竞赛 C Youhane's Undergraduate Thesis (大模拟)
链接:https://www.nowcoder.com/acm/contest/94/C大家都知道想从华南理工大学的本科毕业并不是一件简单的事情,作为一名大四即将毕业的学生,优酱正在为她的毕业论文愁眉不展,为什么呢?并不是毕业设计的课题太难了,而是毕业论文有着非常奇怪的格式要求,其中最令人头痛的就是如何正确地引用参考文献。 而众所周知,某工是一个制度非常严格而且变化速度非常快的学校。因此发生...原创 2018-04-07 22:58:44 · 601 阅读 · 0 评论 -
CodeForces - 931B World Cup(模拟)
World Cuptime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe last stage of Football World Cup is played using the play-off system.There are n teams...原创 2018-03-05 11:43:24 · 758 阅读 · 0 评论 -
CodeForces - 919C Seat Arrangements
Seat Arrangementstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputSuppose that you are in a campus and have原创 2018-02-01 00:14:28 · 316 阅读 · 0 评论 -
CodeForces - 919B Perfect Number (打表)
Perfect Numbertime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputWe consider a positive integer perfect, if a原创 2018-02-01 00:11:59 · 909 阅读 · 0 评论 -
CodeForces - 918C The Monster (暴力)
The Monstertime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputAs Will is stuck in the Upside Down, he can stil原创 2018-01-31 16:38:14 · 434 阅读 · 0 评论 -
CodeForces - 910C Minimum Sum(贪心)
Minimum Sumtime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetya has n positive integers a1, a2, ..., an.原创 2018-01-15 17:18:32 · 708 阅读 · 0 评论 -
HihoCoder - 1632 Secret Poems (2017ICPC北京站 模拟)
#1632 : Secret Poems时间限制:1000ms单点时限:1000ms内存限制:256MB描述The Yongzheng Emperor (13 December 1678 – 8 October 1735), was the fifth emperor of the Qing dynasty of China. He wa原创 2017-11-25 18:38:53 · 607 阅读 · 0 评论 -
HihoCoder - 1631 Cats and Fish (2017ICPC北京站 模拟)
#1631 : Cats and Fish时间限制:1000ms单点时限:1000ms内存限制:256MB描述There are many homeless cats in PKU campus. They are all happy because the students in the cat club of PKU take goo原创 2017-11-25 18:36:02 · 337 阅读 · 0 评论 -
GYM - 100812A Tale of Debt (思维好题)
题意:这道题是一道神题!……题意很难懂,很难解释。读懂了之后无从下手……解题思路:最后抽象再抽象……发现就是一个借钱与还钱的问题。我们从后往前想。即一开始每人手头上都有一些钱,然后大家互相借钱!形成了题目中的欠钱表!!现在题目的意思其实是,给你欠钱表,要你求每个人手头上一开始有多少钱!这样想的话,应该会简单很多了!题目中的不能为负,其实就是保证了一开始大家肯定都有钱或钱为0!然后我们就原创 2017-12-02 21:35:20 · 284 阅读 · 0 评论 -
Gym - 101775B Scapegoat (贪心)(2017ECFinal B)
B. Scapegoattime limit per test3.0 smemory limit per test256 MBinputstandard inputoutputstandard outputAori is very careless so she is always making troubles. One day she does it again, with N big tro...原创 2018-05-10 14:07:44 · 1699 阅读 · 0 评论 -
HDU - 6278 Just h-index(2018CCPC湘潭邀请赛C)
Just h-index Time Limit: 6000/3000 MS (Java/Others) Memory Limit: 132768/132768 K (Java/Others)Total Submission(s): 0 Accepted Submission(s): 0 Problem DescriptionThe h-index of...原创 2018-05-19 18:11:52 · 475 阅读 · 0 评论 -
UVALive - 7503 Change (枚举)
解题思路:枚举即可!然后突然就会发现规律了! #include <iostream>#include <cstring>#include <map>#include <vector>#include <algorithm>using namespace std;typedef long long...原创 2018-11-15 21:56:59 · 256 阅读 · 0 评论 -
ZOJ - 4061 Magic Multiplication (构造)(2018ICPC青岛D)
Magic MultiplicationTime Limit: 1 Second Memory Limit: 65536 KBBaoBao is now learning a new binary operation between two positive integers, represented by , in his magic book. The book tells ...原创 2018-11-07 16:36:09 · 884 阅读 · 0 评论 -
CodeForces - 1000F One Occurrence(莫队+分块 | 线段树 | 主席树)
F. One Occurrencetime limit per test3 secondsmemory limit per test768 megabytesinputstandard inputoutputstandard outputYou are given an array aa consisting of nn integers, and qq que...原创 2018-10-23 17:44:27 · 472 阅读 · 0 评论 -
CodeForces - 980E The Number Games(贪心+树上倍增)
E. The Number Gamestime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe nation of Panel holds an annual show called The Number Ga...原创 2018-10-08 17:44:47 · 224 阅读 · 0 评论 -
CodeForces - 1064C Oh Those Palindromes(思维)
C. Oh Those Palindromestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputA non-empty string is called palindrome, if it reads the ...原创 2018-10-14 23:34:08 · 308 阅读 · 2 评论 -
Gym - 101889B Buggy ICPC (思维)
题意:遇到元音就翻转字符串,问你有多少种输入方式解题思路:只有最中间的两个元音会影响答案,统计最中间的两个元音之间有多少个辅音即可。 #include<bits/stdc++.h>using namespace std;const int MAXN=100005;typedef long long ll;bool check(char a){ ...原创 2018-10-13 21:45:54 · 665 阅读 · 2 评论 -
牛客国庆集训派对Day6 B-Board (思维)
链接:https://www.nowcoder.com/acm/contest/206/B来源:牛客网 题目描述恬恬有一个nx n的数组。她在用这个数组玩游戏:开始时,数组中每一个元素都是0。恬恬会做某些操作。在一次操作中,她可以将某一行的所有元素同时加上一个值,也可以将某一列的所有元素同时加上一个值。在几次操作后,一个元素被隐藏了。你能帮助她回忆隐藏的数是几吗?输入描述:...原创 2018-10-06 19:11:06 · 461 阅读 · 0 评论 -
计蒜客 Lattice's basics in digital electronics(2018 ICPC亚洲区域赛网络赛 沈阳 I)(大模拟)
LATTICE is learning Digital Electronic Technology. He is talented, so he understood all those pieces of knowledge in 10^{-9}10−9 second. In the next 10^{-9}10−9 second, he built a data decoding device...原创 2018-09-10 19:28:21 · 199 阅读 · 0 评论 -
ZOJ - 4054 Traveling on the Axis(ACM-ICPC 2018 青岛赛区网络预赛 H)(思维)
Traveling on the AxisTime Limit: 1 Second Memory Limit: 65536 KBBaoBao is taking a walk in the interval on the number axis, but he is not free to move, as at every point for all , where is...原创 2018-09-17 15:32:31 · 442 阅读 · 0 评论 -
HDU - 6438 Buy and Resell (优先队列)(2018中国大学生程序设计竞赛 - 网络选拔赛 1001)
Buy and ResellTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 742 Accepted Submission(s): 194 Problem DescriptionThe Power Cube is us...原创 2018-08-25 23:48:24 · 350 阅读 · 0 评论 -
2018年上海金马五校程序设计竞赛 Problem M : Lucky Digits
Problem M : Lucky DigitsFrom: DHUOJ, 2018060913Submit (Out of Contest)Time Limit: 1 sDescriptionTommy has a tiny calculator, which only has a display, a plus button, and a minus button. Currently, the...原创 2018-06-09 17:20:21 · 407 阅读 · 0 评论 -
HDU - 6291 对称数 (树上莫队+分块) (2018CCPC女生赛)
对称数Time Limit: 30000/15000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 70 Accepted Submission(s): 8Problem Description小Q认为,偶数具有对称美,而奇数则没有。给定一棵n个点的树,任意两点之间有且仅...原创 2018-05-30 18:30:17 · 914 阅读 · 0 评论 -
HDU - 6294 SA-IS后缀数组(思维)(2018CCPC女生赛)
SA-IS后缀数组Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 512000/512000 K (Java/Others)Total Submission(s): 226 Accepted Submission(s): 75Problem Description小Q最近阅读了SA-IS算法在线性时间内构造后缀数组的相关论文,面...原创 2018-05-30 15:09:37 · 1170 阅读 · 0 评论 -
ZOJ - 4033 CONTINUE...? (2018浙江省赛 J)
CONTINUE...?Time Limit: 1 Second Memory Limit: 65536 KB Special JudgeDreamGrid has classmates numbered from to . Some of them are boys and the others are girls. Each classmate has some gem...原创 2018-04-29 21:49:14 · 1112 阅读 · 0 评论 -
ZOJ - 4034 Mahjong Sorting (2018浙江省赛 K)
Mahjong SortingTime Limit: 1 Second Memory Limit: 65536 KBDreamGrid has just found a set of Mahjong with suited tiles and a White Dragon tile in his pocket. Each suited tile has a suit (Characte...原创 2018-04-29 21:44:44 · 1451 阅读 · 2 评论 -
ZOJ - 4035 Doki Doki Literature Club(2018浙江省赛 L)
Doki Doki Literature ClubTime Limit: 1 Second Memory Limit: 65536 KBDoki Doki Literature Club! is a visual novel developed by Team Salvato. The protagonist is invited by his childhood friend, Say...原创 2018-04-29 21:38:46 · 833 阅读 · 0 评论 -
GYM - 100812B Set of Tasks (思维好题)
Set of Taskstime limit per test2.0 smemory limit per test256 MBinputstandard inputoutputstandard outputI was heading to the old tavern «ChivalryForces», because原创 2017-12-02 16:02:00 · 365 阅读 · 0 评论 -
GYM - 100812J Feeling of Comradeship (暴力)
Feeling of Comradeshiptime limit per test2.0 smemory limit per test256 MBinputstandard inputoutputstandard outputI was tired. Tired of hiding and wandering. Thr原创 2017-12-01 00:05:51 · 296 阅读 · 1 评论 -
GYM - 100812D Dream of Sum (记录前缀和位置)
Dream of Sumtime limit per test2.0 smemory limit per test256 MBinputstandard inputoutputstandard outputSometimes you must fall in order to rise but I seemed to原创 2017-11-30 23:45:08 · 263 阅读 · 0 评论 -
2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 B. Train Seats Reservation
You are given a list of train stations, say from the station 11 to the station 100100.The passengers can order several tickets from one station to another before the train leaves the station one.原创 2017-09-24 17:28:34 · 383 阅读 · 0 评论 -
2017 ACM-ICPC 亚洲区(南宁赛区)网络赛 A. Weather Patterns
Consider a system which is described at any time as being in one of a set of NN distinct states, 1,2,3,...,N1,2,3,...,N. We denote the time instants associated with state changes as t = 1,2,...t原创 2017-09-24 17:24:49 · 1383 阅读 · 0 评论 -
Codeforces - 862A Mahmoud and Ehab and the MEX
Codeforces 862A Mahmoud and Ehab and the MEXA. Mahmoud and Ehab and the MEXDr. Evil kidnapped Mahmoud and Ehab in the evil land because of their performance in the Evil Olympiad in Informatics (EOI). He decided to give them some problems原创 2017-09-20 11:35:41 · 349 阅读 · 0 评论