技巧性
文章平均质量分 83
DOLFAMINGO
诗酒趁年华
展开
-
Codeforces Round #254 (Div. 2) A. DZY Loves Chessboard —— dfs
题目链接: http://codeforces.com/problemset/problem/445/A 题解: 这道题是在现场赛的最后一分钟通过的,相当惊险,而且做的过程也很曲折。 先是用递推,结果发现递推下去可能会出现非法的情况(一开始还不知道,坚定不移地认为这种方法是对的。Now,what can I say?) 然后用回溯,就是类似在递推的方式下,如果遇到非法就退回上一步,原创 2017-03-24 15:50:31 · 299 阅读 · 0 评论 -
HDU 5178 pairs —— 思维 + 二分
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=5178 pairs Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3090 Accepted Submissio原创 2017-07-29 21:56:19 · 416 阅读 · 0 评论 -
Codeforces Round #205 (Div. 2) D. Queue —— 技巧
题目链接:http://codeforces.com/contest/353/problem/D D. Queue time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output原创 2017-07-08 21:58:50 · 390 阅读 · 0 评论 -
BZOJ1483 梦幻布丁 —— 链表启发式合并
题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=1483 Description N个布丁摆成一行,进行M次操作.每次将某个颜色的布丁全部变成另一种颜色的,然后再询问当前一共有多少段颜色.例如颜色分别为1,2,2,1的四个布丁一共有3段颜色. Input 第一行给出N,M表示布丁的个数和好友的操作次数原创 2017-07-25 10:50:12 · 281 阅读 · 0 评论 -
Codeforces Round #340 (Div. 2) E. XOR and Favorite Number —— 莫队算法
题目链接:http://codeforces.com/problemset/problem/617/E E. XOR and Favorite Number time limit per test 4 seconds memory limit per test 256 megabytes input standard input ou原创 2017-07-21 22:03:39 · 309 阅读 · 0 评论 -
BZOJ 2002 Bounce 弹飞绵羊 —— 分块算法
题目链接:https://vjudge.net/problem/HYSBZ-2002 Description 某天,Lostmonkey发明了一种超级弹力装置,为了在他的绵羊朋友面前显摆,他邀请小绵羊一起玩个游戏。游戏一开始,Lostmonkey在地上沿着一条直线摆上n个装置,每个装置设定初始弹力系数ki,当绵羊达到第i个装置时,它会往后弹ki步,达到第i+ki个装置,若不存在原创 2017-07-23 23:12:33 · 337 阅读 · 0 评论 -
51Nod 1282 时钟 —— 最小表示法 + 字符串哈希
题目链接:https://vjudge.net/problem/51Nod-1282 1282 时钟 题目来源: Codility 基准时间限制:1 秒 空间限制:131072 KB 分值: 40 难度:4级算法题 有N个时钟,每个时钟有M个指针,P个刻度。时钟是圆形的,P个刻度均分整个圆。每个时钟每个指针指向整数刻度,并且每个时钟自身指原创 2017-07-30 19:52:01 · 1015 阅读 · 0 评论 -
Codeforces Beta Round #56 A. Where Are My Flakes? —— 贪心
题目链接:http://codeforces.com/problemset/problem/60/A A. Where Are My Flakes? time limit per test 2 seconds memory limit per test 256 megabytes input standard input output原创 2017-07-10 11:34:12 · 441 阅读 · 0 评论 -
CodeForces - 86D D. Powerful array —— 莫队算法
题目链接:http://codeforces.com/problemset/problem/86/D D. Powerful array time limit per test 5 seconds memory limit per test 256 megabytes input standard input output stan原创 2017-07-23 20:15:37 · 279 阅读 · 0 评论 -
Codeforces Round #376 (Div. 2) D. 80-th Level Archeology —— 差分法 + 线段扫描法
题目链接:http://codeforces.com/contest/731/problem/D D. 80-th Level Archeology time limit per test 2 seconds memory limit per test 256 megabytes input standard input output原创 2017-06-04 15:06:19 · 731 阅读 · 0 评论 -
BestCoder Round #92 1002 Count the Sheep —— 枚举+技巧
题目链接:http://bestcoder.hdu.edu.cn/contests/contest_showproblem.php?cid=748&pid=1002 题解: 做题的时候只是想到用dfs暴搜,结果超时了。(刚学dfs时以为它无所不能,后来渐渐不太喜欢了,因为太暴力了,经常超时) TLE wa代码如下: #include using namespa原创 2017-03-17 14:46:52 · 408 阅读 · 0 评论 -
2017广东工业大学程序设计竞赛 E倒水(Water)
题目链接:http://www.gdutcode.sinaapp.com/problem.php?cid=1057&pid=4 题解: 方法一:对n取2的对数: #include #include #include #include #include #include #include #include #include #include #include #define LL lo原创 2017-04-14 22:40:14 · 458 阅读 · 0 评论 -
HDU1873 看病要排队 —— 优先队列(STL)
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1873 题解: 题目已经说出了解题方法:优先队列。但是之前没有学过优先队列,而且这题还是在现场赛做的。由于不会写优先队列的排序函数,所以自己想了个方法,觉得这种思维还可以,还是用优先队列。 如果这样声明优先队 列priority_queueint>q[4]; 那么q是从大到小排列原创 2017-03-27 20:34:51 · 402 阅读 · 0 评论 -
SCUT129 笔芯值 —— DP or 容斥原理
题目链接:https://scut.online/p/129 题解: …… #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;原创 2017-05-05 15:10:44 · 332 阅读 · 0 评论 -
CSU 1554 SG Value —— 思维
题目链接:http://acm.csu.edu.cn/csuoj/problemset/problem?pid=1554 Description The SG value of a set (multiset) is the minimum positive integer that could not be constituted of the number in thi原创 2017-05-22 21:18:22 · 363 阅读 · 0 评论 -
Codeforces Round #371 (Div. 2) C. Sonya and Queries —— 二进制压缩
题目链接:http://codeforces.com/contest/714/problem/C 题解: 待定…… 代码如下: #include #include #include #include #include #include #include #include #include #include #include #define LL long long #defi原创 2017-04-05 16:12:42 · 312 阅读 · 0 评论 -
Codeforces Round #401 (Div. 2) C Alyona and Spreadsheet —— 打表
题目链接:http://codeforces.com/contest/777/problem/C 题解: 给出一个表格,给出l和r,问在l行和r行内(包括l行和r行),是否最少有一列,这列数随行数的递增,为非递减数列。 其中有k个l和r,k 其实怎么打表我是不会做的,所以还是看了通过的代码,发现他们都好聪明。 方法如下:用tt[j]现时记录在i行内,在aij以上(原创 2017-03-17 14:31:27 · 280 阅读 · 0 评论 -
Codeforces Round #363 (Div. 2) B. One Bomb —— 技巧
题目链接:http://codeforces.com/contest/699/problem/B 题解: 一开始的做法是: 统计每行每列出现‘*’的次数, 然后再根据这两组数据进行比较,试图找出答案,结果悲剧了,错了n遍…… 后来想到: 首先还是要统计每行每列出现‘*’的次数,以及‘*’出现的总次数,得到r[n]和c[m]数组,以及sum,。然后再枚举每一个格子(O(n^原创 2017-05-05 19:36:40 · 277 阅读 · 0 评论