
数据结构
天夏123
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
HDU-1521 Entropy(哈夫曼树)
原题链接 先建一颗哈夫曼树,在计算各种字符在树中的深度-1,就是该字符编码长度。要特判字符种数为一种的情况。 #include #include #include #include #include #define maxn 10000005 #define INF 1e9 using namespace std; typedef long long ll; struct No原创 2016-06-19 16:05:59 · 637 阅读 · 0 评论 -
Codeforces Round #291 (Div. 2)-C. Watto and Mechanism(Trie树)
原题链接 C. Watto and Mechanism time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Watto, the owner原创 2016-09-28 11:34:27 · 227 阅读 · 0 评论 -
Codeforces Round #296 (Div. 2)-C. Glass Carving
原题链接 C. Glass Carving time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Leonid wants to become a glass c原创 2016-10-14 12:21:42 · 308 阅读 · 0 评论 -
51nod-1437 迈克步(单调栈)
原题链接 1437 迈克步 题目来源: CodeForces 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 有n只熊。他们站成一排队伍,从左到右依次1到n编号。第i只熊的高度是ai。 一组熊指的队伍中连续的一个子段。组的大小就是熊的数目。而组的力量就是这一组熊中最原创 2016-11-07 12:40:54 · 624 阅读 · 0 评论 -
codeforces(722c)-Destroying Array
原题链接 C. Destroying Array time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output You are given an array consist原创 2016-10-02 13:44:54 · 349 阅读 · 0 评论 -
Codeforces Round #243 (Div. 2)-C. Sereja and Swaps(multiset)
原题链接 C. Sereja and Swaps time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output As usual, Sereja has原创 2016-10-18 15:34:55 · 251 阅读 · 0 评论 -
51nod-1158 全是1的最大子矩阵(单调栈)
原题链接 1158 全是1的最大子矩阵 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 给出1个M*N的矩阵M1,里面的元素只有0或1,找出M1的一个子矩阵M2,M2中的元素只有1,并且M2的面积是最大的。输出M2的面积。 Input 第1行:2个数m,原创 2016-10-07 11:40:21 · 1235 阅读 · 0 评论 -
Codeforces Round #378 (Div. 2)-D. Kostya the Sculptor(multiset)
原题链接 D. Kostya the Sculptor time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Kostya is a genial sculpto原创 2016-11-01 11:48:48 · 237 阅读 · 0 评论 -
51nod-1204 Parity(并差集)
原题链接 1204 Parity 题目来源: Ural 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 你的朋友写下一串包含1和0的串让你猜,你可以从中选择一个连续的子串(例如其中的第3到第5个数字)问他,该子串中包含了奇数个还是偶数个1,他会回答你的问题,然后你可以继续提问原创 2017-01-08 23:49:04 · 294 阅读 · 0 评论 -
51nod-1423 最大二“货”(单调栈)
原题链接 1423 最大二“货” 题目来源: CodeForces 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 白克喜欢找一个序列中的次大值。对于一个所有数字都不同的序列 x1, x2, ..., xk (k > 1) ,他的次大值是最大的 xj ,并且满足 xj原创 2017-01-09 11:40:04 · 365 阅读 · 0 评论 -
Codeforces Round #396 (Div. 2)-D. Mahmoud and a Dictionary(并查集)
原题链接 D. Mahmoud and a Dictionary time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Mahmoud wan原创 2017-02-08 18:23:53 · 444 阅读 · 0 评论 -
Educational Codeforces Round 19-D. Broken BST
原题链接 D. Broken BST time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Let T be arbitrary binary tree — tre原创 2017-05-07 18:09:13 · 364 阅读 · 0 评论 -
51nod-1215 数组的宽度(单调栈)
原题链接 1215 数组的宽度 题目来源: Javaman 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 N个整数组成的数组,定义子数组a[i]..a[j]的宽度为:max(a[i]..a[j]) - min(a[i]..a[j]),求所有子数组的宽度和。原创 2016-11-04 10:57:13 · 343 阅读 · 0 评论 -
CROC 2016 - Qualification-B. Processing Queries(队列)
原题链接 B. Processing Queries time limit per test 5 seconds memory limit per test 256 megabytes input standard input output standard output In this problem you have to原创 2016-10-13 13:48:48 · 252 阅读 · 0 评论 -
跳舞链
参考http://hihocoder.com/contest/hiho101/problem/1 小Ho最近遇到一个难题,他需要破解一个棋局。 棋局分成了n行,m列,每行有若干个棋子。小Ho需要从中选择若干行使得每一列有且恰好只有一个棋子。 比如下面这样局面: 其中1表示放置有棋子的格子,0表示没有放置棋子。 输入 第1行:1个正整数原创 2016-07-28 10:55:41 · 432 阅读 · 0 评论 -
51nod-1275 连续子段的差异(单调队列)
原题链接 1275 连续子段的差异 题目来源: Codility 基准时间限制:1 秒 空间限制:131072 KB 分值: 80 难度:5级算法题 收藏 关注 给出一个包括N个元素的整数数组A,包括A本身在内,共有 (N+1)*N / 2个非空子段。例如:1 3 2的子段为{1} {3} {2} {1 3} {3 2}原创 2016-09-08 23:00:38 · 326 阅读 · 0 评论 -
Codeforces Round #367 (Div. 2) Vasiliy's Multiset(字典树)
原题链接 D. Vasiliy's Multiset time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output Author has gone o原创 2016-08-12 15:55:42 · 272 阅读 · 0 评论 -
HDOJ-2665 Kth number(主席树)
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #define maxn 100005 using namespace std; typedef long long ll;struct Node{ int ls, rs, sum; }p[maxn*20]; int a[maxn], b原创 2016-05-09 23:02:01 · 818 阅读 · 0 评论 -
Codeforces Round #371 (Div. 1)-A. Sonya and Queries(Trie树)
原题链接 A. Sonya and Queries time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Today Sonya learned原创 2016-09-18 23:52:55 · 246 阅读 · 0 评论 -
poj-3250 Bad Hair Day(单调栈)
原题链接 Bad Hair Day Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 17707 Accepted: 5971 Description Some of Farmer John's N cows (1 ≤ N ≤ 80,000) are原创 2016-09-07 17:36:53 · 347 阅读 · 0 评论 -
Codeforces Round #305 (Div. 1)-B. Mike and Feet(单调栈)
原题链接 B. Mike and Feet time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Mike is the president o原创 2016-09-07 16:52:41 · 248 阅读 · 0 评论 -
poj-2823 Sliding Window(单调队列)
原题链接 Sliding Window Time Limit: 12000MS Memory Limit: 65536K Total Submissions: 54929 Accepted: 15814 Case Time Limit: 5000MS Description An array of size原创 2016-09-07 19:29:34 · 294 阅读 · 0 评论 -
Codeforces Round #344 (Div. 2)-C. Report(单调栈)
原题链接 C. Report time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Each month Blake gets the rep原创 2016-09-08 10:07:57 · 297 阅读 · 0 评论 -
Codeforces Round #366 (Div. 2)-C. Thor
原题链接 C. Thor time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Thor is getting used to the Earth. As a g原创 2016-10-12 09:55:58 · 299 阅读 · 0 评论 -
Canada Cup 2016-D. Contest Balloons(优先队列)
原题链接 D. Contest Balloons time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output One tradition of ACM-ICPC con原创 2016-10-23 23:20:53 · 278 阅读 · 0 评论 -
LonLife-ACM 1129 - 喵哈哈村的战斗魔法师丶坏坏い月
原题链接 1129 - 喵哈哈村的战斗魔法师丶坏坏い月 Time Limit:3s Memory Limit:256MByte Submissions:381Solved:85 DESCRIPTION 坏坏い月是月大叔的ID,他是一个掌握者772002种魔法的物理系战士,最擅长的技能就是搞事。今天他又要开始搞事了。 给你nn个数,原创 2017-06-03 08:51:12 · 657 阅读 · 0 评论