acm
文章平均质量分 80
LiQiyaoo
技术改变生活。
展开
-
FZU 2150 Fire Game (双起点BFS)
Fat brother and Maze are playing a kind of special (hentai) game on an N*M board (N rows, M columns). At the beginning, each grid of this board is consisting of grass or just empty and then they start原创 2017-04-16 12:37:15 · 1086 阅读 · 0 评论 -
HDU 1285 (拓扑排序模板)
确定比赛名次Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 21874 Accepted Submission(s): 8769Problem Description有N个比赛队(1 Input原创 2016-07-29 16:05:34 · 381 阅读 · 0 评论 -
HDU 2544(最短路径 SPFA 算法模板)
F - 最短路Crawling in process...Crawling failedTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmitStatus Practice HDU 2544 uDebugDescription原创 2016-07-28 20:00:38 · 1997 阅读 · 0 评论 -
POJ 3253 Fence Repair (哈夫曼算法)
Fence RepairTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 39116 Accepted: 12719DescriptionFarmer John wants to repair a small length of the fence ar原创 2016-07-18 22:28:52 · 357 阅读 · 0 评论 -
POJ 3069 Saruman's Army(贪心算法)
Saruman's ArmyTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 7526 Accepted: 3845DescriptionSaruman the White must lead his army along a straight pa原创 2016-07-18 19:30:05 · 461 阅读 · 0 评论 -
2016天梯赛 列车调度
L2-014. 列车调度火车站的列车调度铁轨的结构如下图所示。Figure两端分别是一条入口(Entrance)轨道和一条出口(Exit)轨道,它们之间有N条平行的轨道。每趟列车从入口可以选择任意一条轨道进入,最后从出口离开。在图中有9趟列车,在入口处按照{8,4,2,5,3,9,1,6,7}的顺序排队等待进入。如果要求它们必须按序号递减的顺序从出口离开,则至少需要原创 2016-07-18 18:57:25 · 2577 阅读 · 0 评论 -
HDU 1874 (迪杰斯特拉 + 邻接表 + 优先队列 模板)
畅通工程续Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 45140 Accepted Submission(s): 16764Problem Description某省自从实行了很多年的畅通工程计划后,终于修原创 2016-07-28 09:56:16 · 1071 阅读 · 0 评论 -
HDU 2222 (AC自动机模板)
Keywords SearchTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10744 Accepted Submission(s): 3722Problem DescriptionIn原创 2016-07-27 20:45:00 · 357 阅读 · 0 评论 -
HDU 1823 Luck and Love (二维线段树模板)
Luck and LoveTime Limit: 10000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6435 Accepted Submission(s): 1637Problem Description世界上上最远的距离不是相隔天涯原创 2016-07-26 16:37:15 · 363 阅读 · 0 评论 -
HDU 1394 Minimum Inversion Number (线段树)
Minimum Inversion NumberTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 17260 Accepted Submission(s): 10496Problem Description原创 2016-07-25 15:26:13 · 283 阅读 · 0 评论 -
NYOJ 117 求逆序数 (树状数组 + 离散化思路)
求逆序数时间限制:2000 ms | 内存限制:65535 KB难度:5描述在一个排列中,如果一对数的前后位置与大小顺序相反,即前面的数大于后面的数,那么它们就称为一个逆序。一个排列中逆序的总数就称为这个排列的逆序数。现在,给你一个N个元素的序列,请你判断出它的逆序数是多少。比如 1 3 2 的逆序数就是1。输入第一行输入一个整数原创 2016-07-24 10:26:56 · 547 阅读 · 1 评论 -
HDU 5723 Abandoned country (最小生成树 + 期望值)
Abandoned countryTime Limit: 8000/4000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 3264 Accepted Submission(s): 802Problem DescriptionAn abando原创 2016-07-23 16:13:14 · 466 阅读 · 0 评论 -
NYOJ 983 首尾相连数组的最大子数组和
首尾相连数组的最大子数组和时间限制:1000 ms | 内存限制:65535 KB难度:4描述给定一个由N个整数元素组成的数组arr,数组中有正数也有负数,这个数组不是一般的数组,其首尾是相连的。数组中一个或多个连续元素可以组成一个子数组,其中存在这样的子数组arr[i],…arr[n-1],arr[0],…,arr[j],现在请你这个ACM_Lover用一个最原创 2016-07-23 15:43:08 · 862 阅读 · 0 评论 -
NYOJ 515 完全覆盖 II (状态压缩dp)
完全覆盖 II时间限制:1000 ms | 内存限制:65535 KB难度:4描述有一天acmj在玩一种游戏----用2*1或1*2的骨牌把m*n的棋盘完全覆盖。但他感觉把棋盘完全覆盖有点简单,他想能不能把完全覆盖的种数求出来?由于游戏难度增加他自己已经没法解决了,于是他希望大家能用程序来帮他把问题解决了。输入有多组数据。每组数据占一行,有两个正原创 2016-06-10 18:03:29 · 1804 阅读 · 0 评论 -
People Counting - 16年浙江省省赛I题 ZOJ 3944
People CountingTime Limit: 2 Seconds Memory Limit: 65536 KBIn a BG (dinner gathering) for ZJU ICPC team, the coaches wanted to count the number of people present at the BG. They did that原创 2016-04-24 16:26:50 · 1198 阅读 · 2 评论 -
ZOJ 3609 Modular Inverse (FLOYD判圈算法)
Modular InverseTime Limit: 2 Seconds Memory Limit: 65536 KBThe modular modular multiplicative inverse of an integer a modulo m is an integer x such that a-1≡x (mod m). This is equivalen原创 2016-04-22 14:20:45 · 580 阅读 · 0 评论 -
Highway Project 浙江省第十三届省赛K题 ZOJ 3946(dijkstra+邻接表+优先队列)
Highway ProjectTime Limit: 2 Seconds Memory Limit: 65536 KBEdward, the emperor of the Marjar Empire, wants to build some bidirectional highways so that he can reach other cities from the原创 2016-05-03 21:51:14 · 818 阅读 · 0 评论 -
01背包多种状态方程
01背包多种解法 1. 状态转移方程: dp[i][j] = dp[i + 1][j] -------------( j dp[i][j] = max( dp[i + 1][j] , dp[i + 1][j - we[i] ] +va[i]) ------其他情况从第i个物品开始挑选总重小于j时,总价值最大。dp[0][v]就是答案。代码如下:原创 2016-07-19 19:31:58 · 390 阅读 · 0 评论 -
树状数组模板 HDU1166
#include#include#includeusing namespace std;int a[50005];int tree[50005];//树状数组 char s[20];int n;void add(int k, int num){ while(k <= n) { tree[k] += num; k += k & (-k);//lowbit(k) }原创 2016-07-20 22:00:17 · 284 阅读 · 0 评论 -
ZOJ 3607 Lazier Salesgirl (贪心,模拟)
DescriptionKochiya Sanae is a lazy girl who makes and sells bread. She is an expert at bread making and selling. She can sell the i-th customer a piece of bread for price pi. But she is so lazy原创 2017-04-15 13:41:11 · 585 阅读 · 0 评论 -
POJ 2965 The Pilots Brothers' refrigerator (DFS + 枚举)
The Pilots Brothers' refrigeratorTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 26183 Accepted: 10089 Special JudgeDescriptionThe game “The Pil原创 2017-04-18 16:20:24 · 633 阅读 · 0 评论 -
ZOJ 3603 Draw Something Cheat (字符串,小陷阱)
Have you played Draw Something? It's currently one of the hottest social drawing games on Apple iOS and Android Devices! In this game, you and your friend play in turn. You need to pick a word and dra原创 2017-04-13 20:51:52 · 817 阅读 · 0 评论 -
POJ 1753 Flip Game (DFS + 暴力枚举)
Flip GameTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 44428 Accepted: 19079DescriptionFlip game is played on a rectangular 4x4 field with two-sided原创 2017-04-17 22:10:14 · 481 阅读 · 0 评论 -
NYOJ 题目772 数独
数独时间限制:1000 ms | 内存限制:65535 KB难度:4描述 数独是一种运用纸、笔进行演算的逻辑游戏。玩家需要根据9×9盘面上的已知数字,推理出所有剩余空格的数字,并满足每一行、每一列、每一个3*3宫内的数字均含1-9,不重复。 每一道合格的数独谜题都有且仅有唯一答案,推理方法也以此为基础,任何无解或多解的题目都是不合格的。原创 2016-02-10 20:12:37 · 927 阅读 · 0 评论 -
FatMouse and Cheese (DFS + DP 记忆化搜索)
FatMouse and CheeseTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9643 Accepted Submission(s): 4067Problem DescriptionFatMou原创 2017-04-03 19:22:23 · 428 阅读 · 0 评论 -
MG loves gold (map)
MG loves goldTime Limit: 3000/1500 MS (Java/Others) Memory Limit: 262144/262144 K (Java/Others)Total Submission(s): 131 Accepted Submission(s): 80Problem DescriptionMG is a lucky原创 2017-04-02 15:48:34 · 722 阅读 · 0 评论 -
蓝桥杯 剪格子 (DFS)
问题描述如下图所示,3 x 3 的格子中填写了一些整数。+--*--+--+|10* 1|52|+--****--+|20|30* 1|*******--+| 1| 2| 3|+--+--+--+我们沿着图中的星号线剪开,得到两个部分,每个部分的数字和都是60。本题的要求就是请你编程判定:对给定的m x n 的格子中的整数,是否可以分割为原创 2017-04-02 14:23:14 · 444 阅读 · 0 评论 -
POJ 1182 食物链 【并查集】
食物链Time Limit: 1000MS Memory Limit: 10000KTotal Submissions: 69466 Accepted: 20539Description动物王国中有三类动物A,B,C,这三类动物的食物链构成了有趣的环形。A吃B, B吃C,C吃A。 现有N个动物,以1-N编号。每个动原创 2017-03-26 09:57:32 · 337 阅读 · 0 评论 -
POJ 2431 Expedition (贪心+优先队列)
ExpeditionTime Limit: 1000MS Memory Limit: 65536KTotal Submissions: 14945 Accepted: 4188DescriptionA group of cows grabbed a truck and ventured on an expedition原创 2017-03-24 21:47:39 · 592 阅读 · 0 评论 -
HDU 5907 Find Q
Find QTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 262144/131072 K (Java/Others)Total Submission(s): 1384 Accepted Submission(s): 608Problem DescriptionByteasar is addict原创 2017-03-23 17:12:27 · 313 阅读 · 0 评论 -
HDU 6015 Skip the Class (map)
Skip the ClassTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 837 Accepted Submission(s): 484Problem DescriptionFinally term原创 2017-03-23 09:13:53 · 347 阅读 · 0 评论 -
NYOJ 586 疯牛 (二分搜索答案)
疯牛时间限制:1000 ms | 内存限制:65535 KB难度:4描述农夫 John 建造了一座很长的畜栏,它包括N (2 但是,John的C (2 输入有多组测试数据,以EOF结束。第一行:空格分隔的两个整数N和C第二行——第N+1行:分别指出了xi的位置输出每组测试数据输出一个整数,满足题意的最大的最小值,注意换行。样例输入原创 2017-03-22 19:05:12 · 719 阅读 · 0 评论 -
HDU 3165 Trainsorting (DP, LIS)
TrainsortingTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 436 Accepted Submission(s): 124Problem DescriptionErin is an engi原创 2017-03-20 19:43:06 · 1095 阅读 · 0 评论 -
HDU 1532 Drainage Ditches (最大流模板)
Drainage DitchesTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 15001 Accepted Submission(s): 7124Problem DescriptionEvery time i原创 2016-08-02 16:09:27 · 394 阅读 · 0 评论 -
HDU 2586 How far away ? (LCA模板题 Tarjan算法求最小公共祖先)
How far away ?Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 12461 Accepted Submission(s): 4596Problem DescriptionThere are n ho原创 2016-08-01 18:31:26 · 594 阅读 · 1 评论 -
POJ 3164 Command Network (最小树形图模板 朱刘算法)
Command NetworkTime Limit: 1000MS Memory Limit: 131072KTotal Submissions: 16426 Accepted: 4731DescriptionAfter a long lasting war on words, a war on arms finall原创 2016-08-04 10:55:18 · 510 阅读 · 0 评论 -
HDU 4135 Co-prime (包含排斥原理+筛选法求素数)
Co-primeTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 3216 Accepted Submission(s): 1245Problem DescriptionGiven a number原创 2016-04-18 10:10:37 · 1211 阅读 · 0 评论 -
HDU 5672 String (尺取法)
StringTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Submission(s): 1077 Accepted Submission(s): 348Problem DescriptionThere is a string S.原创 2016-04-28 09:19:11 · 520 阅读 · 0 评论 -
Catch him(BFS)
B - Catch himTime Limit:1000MS Memory Limit:32768KB 64bit IO Format:%I64d & %I64uSubmit Status Practice HDU 2531Description在美式足球中,四分卫负责指挥整只球队的进攻战术和跑位,以及给接球员传球的任务。四分卫是一只球队原创 2016-03-17 10:04:33 · 479 阅读 · 0 评论 -
NYOJ 题目115 城市平乱 (最短路径-迪杰斯特拉算法)
城市平乱时间限制:1000 ms | 内存限制:65535 KB难度:4描述南将军统领着N个部队,这N个部队分别驻扎在N个不同的城市。他在用这N个部队维护着M个城市的治安,这M个城市分别编号从1到M。现在,小工军师告诉南将军,第K号城市发生了暴乱,南将军从各个部队都派遣了一个分队沿最近路去往暴乱城市平乱。现在已知在任意两个城市之间原创 2016-03-04 19:45:24 · 2119 阅读 · 0 评论