原题戳我There are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to the following...
分类:
其他好文 时间:
2014-08-25 22:46:14
阅读次数:
307
Candy
Total Accepted: 16107 Total
Submissions: 85614My Submissions
There are N children standing in a line. Each child is assigned a rating value.
You are giving candies to these c...
分类:
其他好文 时间:
2014-08-24 16:44:32
阅读次数:
182
LeetCode: CandyThere are N children standing in a line. Each child is assigned a rating value.You are giving candies to these children subjected to th...
分类:
其他好文 时间:
2014-08-23 15:09:00
阅读次数:
157
Candies
Time Limit: 1500MS
Memory Limit: 131072K
Total Submissions: 23152
Accepted: 6234
Description
During the kindergarten days, flymouse was the monitor of his c...
分类:
其他好文 时间:
2014-08-23 14:03:00
阅读次数:
157
被第二个条件给坑了
You are giving candies to these children subjected to the following requirements:
Each child must have at least one candy.Children with a higher rating get more candies than their ne...
分类:
其他好文 时间:
2014-08-23 11:20:30
阅读次数:
173
题目链接:http://poj.org/problem?id=3159
题意:给出m给 x 与y的关系,其中y的糖数不能比x的多c个,即y-x 最后求fly[n]最多能比so[1]
多多少糖?
差分约束问题, 就是求1-n的最短路, 队列实现spfa
会超时了,改为栈实现,即可
有负环时,用栈比队列快
数组开小了,不报RE,报超时 ,我晕
#in...
分类:
其他好文 时间:
2014-08-23 10:00:50
阅读次数:
158
题目地址:POJ 3159
第一发差分约束的题。。就当作最短路来做了。。。直接建图+spfa。。不过我用的spfa+slf优化都超时。。看了讨论区里的。。把spfa换成栈就过了。。。
代码如下:
#include
#include
#include
#include
#include
#include
#include
#include
#include
#include ...
分类:
其他好文 时间:
2014-08-22 22:38:33
阅读次数:
197
Candies
Time Limit: 1500MS
Memory Limit: 131072K
Total Submissions: 23131
Accepted: 6224
Description
During the kindergarten days, flymouse was the monitor of his cla...
分类:
其他好文 时间:
2014-08-22 22:36:24
阅读次数:
251
CandiesCrawling in process...
Crawling failed
Time Limit:1500MS
Memory Limit:131072KB
64bit IO Format:%I64d & %I64u
Submit
Status
Description
During the kindergarten days,...
分类:
其他好文 时间:
2014-08-22 17:52:49
阅读次数:
215
解题报告
题目传送门
题意:
先输入n,m
接下来m行,每行输入A,B,C
输入A B C,表示孩子B最多比孩子A多C块蛋糕,问孩子1与孩子N最多相差多少块蛋糕!
思路:
求解b-a
源点为1
spfa+queue超时,spfa+queue+slf还超时,用stack却过了。
#include
#include
#include
#include
#in...
分类:
其他好文 时间:
2014-08-22 14:29:48
阅读次数:
178