
模板
文章平均质量分 72
ummmmm
这个作者很懒,什么都没留下…
展开
-
[KM算法 O(n^ 3) ] 带权二分图最大匹配
奔小康赚大钱Time Limit: 1000/1000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 18257Accepted Submission(s): 7702Problem Description传说在遥远的地方有一个非常富裕的村落,有一天,村长...原创 2019-11-05 20:09:48 · 292 阅读 · 0 评论 -
[2-SAT] 输出路径 POJ3683 Priest John's Busiest Day
Priest John's Busiest DayTime Limit:2000MS Memory Limit:65536K Total Submissions:13255 Accepted:4495 Special Judge DescriptionJohn is the only priest in his town. S...原创 2019-10-30 21:00:43 · 223 阅读 · 0 评论 -
[概率DP] B - Discovering Gold LightOJ - 1030
You are in a cave, a long cave! The cave can be represented by a 1 x N grid. Each cell of the cave can contain any amount of gold.Initially you are in position 1. Now each turn you throw a perfect 6...原创 2018-11-26 14:21:23 · 233 阅读 · 0 评论 -
[区间DP] B - Halloween Costumes LightOJ - 1422
Gappu has a very busy weekend ahead of him. Because, next weekend is Halloween, and he is planning to attend as many parties as he can. Since it's Halloween, these parties are all costume parties, Gap...原创 2018-11-23 19:12:13 · 213 阅读 · 0 评论 -
[求逆序对] Petr and Permutations CF987E
E. Petr and Permutationstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputPetr likes to come up with problems about randomly gener...原创 2018-11-21 16:39:45 · 348 阅读 · 0 评论 -
[后缀数组] 求不同子串总数 SPOJ - DISUBSTR
DISUBSTR - Distinct Substrings#suffix-array-8 Given a string, we need to find the total number of its distinct substrings.InputT- number of test cases. T<=20;Each test case consists of o...原创 2018-10-11 21:08:02 · 261 阅读 · 0 评论 -
[容斥 组合数学] 求序列不相邻恰好k种颜色着色 Gym - 100548F
逆元 适用 mod 为素数 C(n, m) 函数适用 n, m 在 1kw 以下时 n 过大时可暴力 均过大用 lucas定理 小于等于 k 种颜色 k * (k - 1) ^ (n - 1) 减去 (k - 1) * (k - 2) ^ (n - 1) * (不选的 k 种可能颜色) 有重复减去的部分 选 i 种颜色的情况数为 C(k, i)#incl...原创 2018-10-25 20:58:42 · 552 阅读 · 0 评论 -
[AC自动机+矩阵快速幂] 求长度为m的不包含某些给定子串的字符串数量 POJ2778
DNA SequenceTime Limit: 1000MS Memory Limit: 65536K Total Submissions: 19748 Accepted: 7525 DescriptionIt's well known that DNA Sequence is a sequence only contains A, C, T and...原创 2018-09-28 21:26:23 · 409 阅读 · 0 评论 -
【AC自动机】多模式串单次匹配 HDU - 2222
Keywords SearchTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 78393 Accepted Submission(s): 27259 Problem DescriptionIn the modern...原创 2018-09-26 23:51:22 · 159 阅读 · 0 评论 -
[匈牙利算法] 数量变化二分图匹配 GCPC 2017 Problem F Plug It In!
Adam just moved into his new apartment and simply placed everything into it at random. This means in particular that he did not put any effort into placing his electronics in a way that each one can h...原创 2018-09-26 13:15:12 · 450 阅读 · 0 评论 -
【01Trie树】 加入删除字符串 HDU5536
Chip FactoryTime Limit: 18000/9000 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 5067 Accepted Submission(s): 2280 Problem DescriptionJohn is a manager...原创 2018-09-18 00:48:38 · 228 阅读 · 0 评论 -
[主席树] 静态区间第k小 洛谷P3834
题目背景这是个非常经典的主席树入门题——静态区间第K小数据已经过加强,请使用主席树。同时请注意常数优化题目描述如题,给定N个整数构成的序列,将对于指定的闭区间查询其区间内的第K小值。输入输出格式输入格式:第一行包含两个正整数N、M,分别表示序列的长度和查询的个数。第二行包含N个整数,表示这个序列各项的数字。接下来M行每行包含三个整数l, r, kl,r,k...原创 2019-01-11 18:39:30 · 349 阅读 · 0 评论 -
[单调队列] 滑动窗口 求长度为m区间内最小值 洛谷P1440
题目描述一个含有n项的数列(n<=2000000),求出每一项前的m个数到它这个区间内的最小值。若前面的数不足m项则从第1个数开始,若前面没有数则输出0。输入输出格式输入格式: 第一行两个数n,m。第二行,n个正整数,为所给定的数列。 输出格式: n行,第i行的一个数ai,为所求序列中第i个数前m个数的最小值。 输入输出样例输入样例#1: ...原创 2019-01-15 21:12:37 · 558 阅读 · 0 评论 -
[交互式+随机] 询问求等差数列 CF1114E
E. Arithmetic Progressiontime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThis is an interactive problem!An arithmetic progress...原创 2019-02-27 16:32:43 · 229 阅读 · 0 评论 -
[DAG支配树(拓扑排序+LCA)] HDU6604 Blow up the city
Blow up the cityTime Limit: 5000/5000 MS (Java/Others)Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 742Accepted Submission(s): 393Problem DescriptionCountry A and B ...原创 2019-09-21 20:37:42 · 397 阅读 · 0 评论 -
约瑟夫环 n, k 第 m 个出圈
ACM-ICPC 2018 沈阳赛区现场赛 K. Let the Flames Begin (约瑟夫环问题)题目链接:题意:有 n 个人围成一个圈,从 1 开始报到第 k 个人出环,问第 m 个出环的人是谁,n、m、k <= 1e18 且 min(m,k)<= 2e6。题解:容易得出O(m)的递推公式 f[n][m] = (f[n-1][m-1] + k - 1)% n +...转载 2019-09-08 20:00:50 · 516 阅读 · 0 评论 -
[快速排序/归并排序] 100000个数 HUSTOJ2496
题目描述输入n组测试数据,从小到大排序.输入输出样例输入233 6 548 5 9 7样例输出3 6 55 7 8 9提示(1 <= n <= 100000)#include <iostream>using namespace std;int a[100000];void paixu(in...原创 2018-03-28 18:56:53 · 2115 阅读 · 0 评论 -
【dinic最小割 输出割边】J - Sabotage UVA - 10480
https://vjudge.net/contest/68128#problem/J/// 跑完最大流后的残余网络/// 从源点及汇点开始 分别标记能到达的点/// 遍历边 两端点标记不同即为割边/// (源点不能到达的点必与汇点连通 标记源点能到达的点)/// (遍历边 一端标记 一端未标记为割边)#include <bits/stdc++.h>...原创 2018-08-02 13:00:30 · 280 阅读 · 0 评论 -
[拓扑排序] 横纵涂色 ZOJ3780
E - Paint the Grid AgainZOJ - 3780Leo has a grid withN×Ncells. He wants to paint each cell with a specific color (either black or white).Leo has a magical brush which can paint any row wit...原创 2019-04-12 17:52:23 · 154 阅读 · 0 评论 -
[tarjan缩点 + 割点 / 割边 + 重边] 无向图求割点
#include <iostream>#include <cstdio>#include <cmath>#include <stack>#include <cstring>#define ll long long#define db doubleusing namespace std;const int mn = ...原创 2019-04-15 20:34:58 · 459 阅读 · 0 评论 -
[组合数递推公式] RGB游戏 ZUFE2019校赛D
问题 D: D - RGB游戏时间限制:1 Sec内存限制:256 MB提交:35解决:6[提交][状态][讨论版]题目描述三水最近发明了一个RGB游戏:有 n 个方格,编号为从 1 到 n,它用七种颜色的颜料给方格上色,每个 方块只能涂一种颜色。总的分值是这 n 个方块得分之和,如果方块被涂成红色,则方块的得分为 2,如 果方块被涂成蓝色则为 3,如果方块被涂...原创 2019-03-18 16:20:57 · 270 阅读 · 0 评论 -
[最大独立集 = 补图的最大团] E. Helping Hiasat CF1105E
E. Helping Hiasattime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputHiasat registered a new account in NeckoForces and when his fri...原创 2019-03-12 21:14:13 · 215 阅读 · 0 评论 -
[分解质因数/阶乘素因子的幂] C. Trailing Loves (or L'oeufs?) CF1114C
C. Trailing Loves (or L'oeufs?)time limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputThe number "zero" is called "love" (or "l'oeuf" t...原创 2019-02-25 19:37:47 · 403 阅读 · 0 评论 -
【单字符串最小最大表示法】O - String Problem HDU - 3374
String ProblemTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4568 Accepted Submission(s): 1851 Problem DescriptionGive you a string ...原创 2018-09-03 22:12:51 · 220 阅读 · 0 评论 -
【Trie字典树(前缀树)】查询前缀出现次数 A - 统计难题 HDU - 1251
统计难题Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 131070/65535 K (Java/Others)Total Submission(s): 57613 Accepted Submission(s): 20135 Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单...原创 2018-09-07 21:57:54 · 674 阅读 · 0 评论 -
【最小树形图 朱刘算法 O(VE)】 Command Network POJ - 3164
After a long lasting war on words, a war on arms finally breaks out between littleken’s and KnuthOcean’s kingdoms. A sudden and violent assault by KnuthOcean’s force has rendered a total failure of li...原创 2018-06-27 12:10:53 · 194 阅读 · 0 评论 -
[埃氏筛法] 线性筛素数 洛谷P3383
题目描述如题,给定一个范围N,你需要处理M个某数字是否为质数的询问(每个数字均在范围1-N内)输入输出格式输入格式:第一行包含两个正整数N、M,分别表示查询的范围和查询的个数。接下来M行每行包含一个不小于1且不大于N的整数,即询问该数是否为质数。输出格式:输出包含M行,每行为Yes或No,即依次为每一个询问的结果。输入输出样例输入样例#1: 复制100 52349197输出样例#1: 复...原创 2018-06-09 17:17:31 · 392 阅读 · 0 评论 -
[Dijkstra] 单源最短路 P3371
题目描述如题,给出一个有向图,请输出从某一点出发到所有点的最短路径长度。输入输出格式输入格式: 第一行包含三个整数N、M、S,分别表示点的个数、有向边的个数、出发点的编号。接下来M行每行包含三个整数Fi、Gi、Wi,分别表示第i条有向边的出发点、目标点和长度。 输出格式: 一行,包含N个用空格分隔的整数,其中第i个整数表示从点S...原创 2018-06-09 13:42:54 · 225 阅读 · 0 评论 -
[最小生成树] 洛谷P3366
题目描述如题,给出一个无向图,求出最小生成树,如果该图不连通,则输出orz输入输出格式输入格式:第一行包含两个整数N、M,表示该图共有N个结点和M条无向边。(N<=5000,M<=200000)接下来M行每行包含三个整数Xi、Yi、Zi,表示有一条长度为Zi的无向边连接结点Xi、Yi输出格式:输出包含一个数,即最小生成树的各边的长度之和;如果该图不连通则输出orz输入输出样例输入样例#...原创 2018-06-09 12:42:17 · 235 阅读 · 0 评论 -
【java】
import java.math.BigInteger;import java.util.Scanner;public class Main { static BigInteger Max(BigInteger a,BigInteger b) { a=a.max(b); return a; } static public void main(String[] args) {...原创 2018-05-11 22:00:08 · 124 阅读 · 0 评论 -
【二分/set/映射】 Can you find it? HDU基础04分治法
Problem DescriptionGive you three sequences of numbers A, B, C, then we give you a number X. Now you need to calculate if you can find the three numbers Ai, Bj, Ck, which satisfy the formula Ai+Bj+Ck ...原创 2018-05-10 21:15:09 · 199 阅读 · 0 评论 -
【矩阵快速幂】CF gym 101473 H Buses
#include <bits/stdc++.h>using namespace std;const long long mod = 1e6;struct M{ long long a[2][2];};M multi(const M& x, const M& y) //矩阵乘法{ M z; for(int i = 0; i < 2; i +...原创 2018-05-30 15:07:41 · 335 阅读 · 0 评论 -
[线段树] I Hate It HDU1754
I Hate ItTime Limit: 9000/3000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 94640 Accepted Submission(s): 35829Problem Description很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当...原创 2018-06-01 19:33:19 · 120 阅读 · 0 评论 -
[倍增 rmq] 忠诚 洛谷P1816
题目描述老管家是一个聪明能干的人。他为财主工作了整整10年,财主为了让自已账目更加清楚。要求管家每天记k次账,由于管家聪明能干,因而管家总是让财主十分满意。但是由于一些人的挑拨,财主还是对管家产生了怀疑。于是他决定用一种特别的方法来判断管家的忠诚,他把每次的账目按1,2,3…编号,然后不定时的问管家问题,问题是这样的:在a到b号账中最少的一笔是多少?为了让管家没时间作假他总是一次问多个问题。输入输...原创 2018-06-01 21:58:59 · 287 阅读 · 0 评论 -
【次小生成树/Prim】Qin Shi Huang's National Road System HDU4081
During the Warring States Period of ancient China(476 BC to 221 BC), there were seven kingdoms in China ---- they were Qi, Chu, Yan, Han, Zhao, Wei and Qin. Ying Zheng was the king of the ki...原创 2018-06-23 14:53:19 · 217 阅读 · 0 评论 -
[树状数组] C - A Simple Problem with Integers POJ - 3468
A Simple Problem with IntegersTime Limit: 5000MS Memory Limit: 131072KTotal Submissions: 133197 Accepted: 41317Case Time Limit: 2000MSDescriptionYou have N integers, A1, A2, ... , AN. You need to deal...原创 2018-07-10 15:35:34 · 232 阅读 · 0 评论 -
【manacher】X - 最长回文 HDU - 3068
最长回文Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 30492 Accepted Submission(s): 11173 Problem Description给出一个只由小写英文字符a,b,c...y,z组成的...原创 2018-09-04 17:50:42 · 163 阅读 · 0 评论 -
[KMP nx数组找循环节] D - Cyclic Nacklace HDU - 3746
Cyclic NacklaceTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 15131 Accepted Submission(s): 6298 Problem DescriptionCC always become...原创 2018-08-19 20:51:27 · 184 阅读 · 0 评论 -
[KMP] A - Number Sequence HDU - 1711
Number SequenceTime Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 40427 Accepted Submission(s): 16672 Problem DescriptionGiven two sequ...原创 2018-08-19 15:04:42 · 366 阅读 · 0 评论 -
[数位DP] C - 不要62 HDU - 2089
不要62Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 56807 Accepted Submission(s): 22123 Problem Description杭州人称那些傻乎乎粘嗒嗒的人为62(音:laoer)...原创 2018-08-14 10:44:50 · 166 阅读 · 0 评论