- 博客(44)
- 收藏
- 关注
原创 KMP简提
KMP是一种复杂度为O(n+m)的字符串匹配算法,最难理解的部分就是Next数组的求解 Next数组即为模板串的每个位置对应的 0~i 位置的前缀与后缀中的最大公共部分,依此公共部分来实现模板串的移动匹配,依此大幅度降低了字符串匹配的复杂度。Next数组的其实就是对模板串相同前缀后缀的一个递归匹配实现。推荐一个理解Next数组的博客:https://www.cnblogs.com/...
2018-08-04 19:28:12
338
原创 牛客多校,gpa
链接:https://www.nowcoder.com/acm/contest/143/A来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 262144K,其他语言524288KSpecial Judge, 64bit IO Format: %lld题目描述Kanade selected n courses in the university. The...
2018-08-02 18:33:21
256
原创 hdu 6315 Naive Operations
Naive OperationsTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 502768/502768 K (Java/Others)Total Submission(s): 853 Accepted Submission(s): 318 Problem DescriptionIn a galaxy far,...
2018-07-26 00:31:00
1196
7
原创 树状数组一点心得
树状数组的基本概念不说了,网上大佬们的讲解博客很多。 先上一段我的模板inline int lowbit(int x) {return x&-x;}inline void update(int x,int val){ for (int i=x; i<maxn; i+=lowbit(i)) tree[i]+=val;}inline int Query(in...
2018-07-20 00:03:11
241
原创 奇数码问题
问题 N: 奇数码问题时间限制: 1 Sec 内存限制: 128 MB提交: 64 解决: 22[提交] [状态] [讨论版] [命题人:admin]题目描述你一定玩过八数码游戏,它实际上是在一个3*3的网格中进行的,1个空格和1~8这8个数字恰好不重不漏地分布在这3*3的网格中。例如:5 2 81 3 _4 6 7在游戏过程中,可以把空格与其上、下、左、右四个方向之...
2018-07-19 23:59:15
983
原创 2018牛客多校第一场 J Different Integers
链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网 时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 524288K,其他语言1048576K64bit IO Format: %lld题目描述Given a sequence of integers a1, a2, ..., an and q pairs of in...
2018-07-19 23:43:56
287
原创 C/C++ 文件复制
#include <bits/stdc++.h>using namespace std;int main(){ //文本文件复制 FILE* f1=fopen("input.txt","r"); FILE* f2=fopen("out.txt","w"); if(!f1||!f2) { printf("-1\n");
2018-07-12 11:34:43
622
原创 cf 教育场 . Micro-World
B. Micro-Worldtime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou have a Petri dish with bacteria and you are preparing to dive into the harsh mic...
2018-06-16 22:04:29
389
原创 cf 教育场 45Commentary Boxes
A. Commentary Boxestime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputBerland Football Cup starts really soon! Commentators from all over the world c...
2018-06-16 21:36:51
222
原创 Common Subsequence
A subsequence of a given sequence is the given sequence with some elements (possible none) left out. Given a sequence X = < x1, x2, ..., xm > another sequence Z = < z1, z2, ..., zk > is a ...
2018-06-14 18:21:11
338
原创 Rotated Palindromes
问题 J: Rotated Palindromes时间限制: 1 Sec 内存限制: 128 MB提交: 4 解决: 3[提交][状态][讨论版][命题人:admin]题目描述Takahashi and Aoki are going to together construct a sequence of integers.First, Takahashi will provide a sequ...
2018-06-12 14:32:51
230
原创 zoj 4045 District Division
District DivisionTime Limit: 1 Second Memory Limit: 65536 KB Special JudgeEzio learned a lot from his uncle Mario in Villa Auditore. He also made some contribution to Villa Auditore. One of ...
2018-06-11 21:30:12
333
原创 问题 I: Sequence
问题 I: Sequence时间限制: 1 Sec 内存限制: 128 MB提交: 25 解决: 15[提交][状态][讨论版][命题人:admin]题目描述You are given an integer sequence of length N. The i-th term in the sequence is ai. In one operation, you can select a ...
2018-06-09 22:09:43
769
原创 问题 J: Simple Knapsack
问题 J: Simple Knapsack时间限制: 1 Sec 内存限制: 128 MB提交: 65 解决: 24[提交][状态][讨论版][命题人:admin]题目描述You have N items and a bag of strength W. The i-th item has a weight of wi and a value of vi.You will select som...
2018-06-09 22:03:36
330
1
原创 P1309 瑞士轮
题目背景在双人对决的竞技性比赛,如乒乓球、羽毛球、国际象棋中,最常见的赛制是淘汰赛和循环赛。前者的特点是比赛场数少,每场都紧张刺激,但偶然性较高。后者的特点是较为公平,偶然性较低,但比赛过程往往十分冗长。本题中介绍的瑞士轮赛制,因最早使用于 18951895 年在瑞士举办的国际象棋比赛而得名。它可以看作是淘汰赛与循环赛的折中,既保证了比赛的稳定性,又能使赛程不至于过长。题目描述2 \times N...
2018-06-07 11:12:35
476
原创 问题 I: T-shirt
问题 I: T-shirt时间限制: 1 Sec 内存限制: 64 MB提交: 14 解决: 7[提交][状态][讨论版][命题人:admin]题目描述JSZKC is going to spend his vacation! His vacation has N days. Each day, he can choose a T-shirt to wear. Obviously, he do...
2018-06-05 21:59:30
1055
1
原创 问题 J: JS Set
问题 J: JS Set时间限制: 1 Sec 内存限制: 128 MB提交: 3 解决: 2[提交][状态][讨论版][命题人:admin]题目描述Let’s consider some math problems. JSZKC has a set A={1,2,…,N}. He defines a subset of A as ‘Meo set’ if there doesn’t exis...
2018-06-04 21:53:18
616
原创 6481: Integers on a Tree
6481: Integers on a Tree时间限制: 1 Sec 内存限制: 128 MB提交: 69 解决: 12[提交][状态][讨论版][命题人:admin]题目描述We have a tree with N vertices. The vertices are numbered 1,2,…,N. The i-th (1≤i≤N−1) edge connects the two v...
2018-06-03 21:20:57
426
原创 6492: Connectivity
6492: Connectivity时间限制: 1 Sec 内存限制: 128 MB提交: 128 解决: 34[提交][状态][讨论版][命题人:admin]题目描述There are N cities. There are also K roads and L railways, extending between the cities. The i-th road bidirection...
2018-06-03 17:11:49
308
原创 6468: Snuke's Coloring
6468: Snuke's Coloring时间限制: 2 Sec 内存限制: 128 MB提交: 50 解决: 22[提交][状态][讨论版][命题人:admin]题目描述We have a grid with H rows and W columns. At first, all cells were painted white.Snuke painted N of these cells...
2018-06-03 16:02:57
610
原创 6463: Tak and Hotels II
6463: Tak and Hotels II时间限制: 1 Sec 内存限制: 128 MB提交: 95 解决: 29[提交][状态][讨论版][命题人:admin]题目描述N hotels are located on a straight line. The coordinate of the i-th hotel (1≤i≤N) is xi.Tak the traveler has t...
2018-06-03 15:05:06
206
原创 Til the Cows Come Home
Bessie is out in the field and wants to get back to the barn to get as much sleep as possible before Farmer John wakes her for the morning milking. Bessie needs her beauty sleep, so she wants to get b...
2018-06-02 17:11:23
208
原创 哈密顿绕行世界问题
一个规则的实心十二面体,它的 20个顶点标出世界著名的20个城市,你从一个城市出发经过每个城市刚好一次后回到出发的城市。 Input前20行的第i行有3个数,表示与第i个城市相邻的3个城市.第20行以后每行有1个数m,m<=20,m>=1.m=0退出. Output输出从第m个城市出发经过每个城市1次又回到m的所有路线,如有多条路线,按字典序输出,每行1条路线.每行首先输出是第几条路线...
2018-06-02 15:25:39
207
原创 Avito Code Challenge 2018 D. Bookshelves
D. Bookshelvestime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputMr Keks is a typical white-collar in Byteland.He has a bookshelf in his office with s...
2018-06-01 17:12:30
197
原创 D. Fair
D. Fairtime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputSome company is going to hold a fair in Byteland. There are nn towns in Byteland and mm two...
2018-05-31 12:56:33
539
原创 C. Three displays
C. Three displaystime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputIt is the middle of 2018 and Maria Stepanovna, who lives outside Krasnokamensk (a ...
2018-05-31 10:08:24
227
原创 B. High School: Become Human
B. High School: Become Humantime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYear 2118. Androids are in mass production for decades now, and they do...
2018-05-30 20:25:30
510
原创 A. Infinity Gauntlet
A. Infinity Gauntlettime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou took a peek on Thanos wearing Infinity Gauntlet. In the Gauntlet there is a...
2018-05-30 19:45:00
485
原创 codeforces acito code challengeC. Useful Decomposition
C. Useful Decompositiontime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputRamesses knows a lot about problems involving trees (undirected connected gr...
2018-05-30 17:36:25
355
原创 Bomb 【数位dp】
The counter-terrorists found a time bomb in the dust. But this time the terrorists improve on the time bomb. The number sequence of the time bomb counts from 1 to N. If the current number sequence inc...
2018-05-27 22:33:19
217
原创 Topcoder Tian Ji‘s Horse Racing
链接:https://www.nowcoder.com/acm/contest/126/A 来源:牛客网时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 32768K,其他语言65536K 64bit IO Format: %lld 题目描述 Tian Ji, one of the military generals of the Qi state during 4t...
2018-05-26 17:06:28
304
原创 Dining kuangbin
Cows are such finicky eaters. Each cow has a preference for certain foods and drinks, and she will consume no others.Farmer John has cooked fabulous meals for his cows, but he forgot to check his menu...
2018-05-23 22:47:54
144
原创 网络流算法
EK算法模板 算法复杂度 n*m*m (n为点数,m为边数) 源点 1, 汇点 n。const int maxn=310,inf=0x7fffffff;int pre[maxn],mat[maxn][maxn];bool vis[maxn];int n,m;int Augment(){ int v; bool fnd=false; memset(pre,0,size...
2018-05-21 18:09:41
263
原创 kuangbin Doing Homework
D - Doing Homework Ignatius has just come back school from the 30th ACM/ICPC. Now he has a lot of homework to do. Every teacher gives him a deadline of handing in the homework. If Ignatius hands in th...
2018-05-18 21:10:36
162
原创 kuangbin Prime Path
F - Prime PathThe ministers of the cabinet were quite upset by the message from the Chief of Security stating that they would all have to change the four-digit room numbers on their offices. — It is a...
2018-05-13 21:59:28
409
原创 ZOJ4033 CONTINUE...?
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:07:51
1150
原创 UPC 5157: Treasure Map
5157: Treasure Map时间限制: 1 Sec 内存限制: 128 MB提交: 113 解决: 23[提交][状态][讨论版][命题人:admin]题目描述You have found a treasure map! The map leads you to several gold mines. The mines each produce gold each day, but ...
2018-04-29 12:33:37
291
原创 CodeForces-266B Queue at the School
B. Queue at the Schooltime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDuring the break the schoolchildren, boys and girls, formed a queue of n peo...
2018-04-28 16:24:28
653
原创 CF Taxi(贪心)
B. Taxitime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputAfter the lessons n groups of schoolchildren went outside and decided to visit Polycarpus t...
2018-04-28 15:29:24
275
原创 Orderly Class
5093: Orderly Class时间限制: 1 Sec 内存限制: 128 MB题目描述Ms. Thomas is managing her class of n students.She placed all her students in a line, and gave the i-th student from the left a card with the letter ai ...
2018-04-22 23:16:34
201
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人