
刷题
文章平均质量分 59
蟹恼板
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
LeetCode 第 223 场周赛
5649. 解码异或后的数组异或运算可逆, 所以直接异或回去.class Solution { public int[] decode(int[] encoded, int first) { int[] res = new int[encoded.length + 1]; res[0] = first; for (int i = 0; i < encoded.length; ++i) { res[i + 1] = re原创 2021-01-10 14:48:36 · 332 阅读 · 0 评论 -
LeetCode 第 38 场双周赛
一阵子没打了, 竟然四题都做出来了.5539. 按照频率将数组升序排序题解很暴力地构建 {数值: 频率} 字典, 再很暴力地根据频率构建 {频率: 降序数值列表}. 最后根据频率升序输出.垃圾代码class Solution: def frequencySort(self, nums: List[int]) -> List[int]: mp = {} for n in nums: mp[n] = mp.get(n, 0) + 1 mp2原创 2020-11-01 01:21:13 · 222 阅读 · 0 评论 -
LeetCode 第 204 场周赛
5499. 重复至少 K 次且长度为 M 的模式垃圾题解 略垃圾代码class Solution: def containsPattern(self, arr: List[int], m: int, k: int) -> bool: print('ohhh') n = len(arr) if m * k > n: return False for i in range(n - m + 1): a原创 2020-08-30 13:10:56 · 471 阅读 · 0 评论 -
[刷题]Codeforces 816B - Karen and Coffee
DescriptionTo stay woke and attentive during classes, Karen needs some coffee! Karen, a coffee aficionado, wants to know the optimal temperature for brewing the perfect cup of coffee. Indeed, she ha原创 2017-07-08 11:33:17 · 591 阅读 · 0 评论 -
[刷题]ACM/ICPC 2016北京赛站网络赛 第1题 第3题
第一次玩ACM。。。有点小紧张小兴奋。这题目好难啊,只是网赛就这么难。。。只把最简单的两题做出来了。题目1: 代码://#define _ACM_#include<iostream>#include<cstring>#include<string>#include<vector>#include<map>#include<set>using namespace std;char li原创 2016-09-24 19:44:23 · 997 阅读 · 0 评论 -
[刷题]ACM ICPC 2016北京赛站网络赛 D - Pick Your Players
DescriptionYou are the manager of a small soccer team. After seeing the shameless behavior of your team during the match, you are mad at all of the current players. Therefore, you have made a huge deci原创 2017-05-15 20:06:06 · 593 阅读 · 0 评论 -
[刷题]Codeforces 758C - Unfair Poll
DescriptionOn the Literature lesson Sergei noticed an awful injustice, it seems that some students are asked more often than others.Seating in the class looks like a rectangle, where n rows with m pupi原创 2017-05-19 22:16:50 · 655 阅读 · 0 评论 -
[刷题]Codeforces Round #412(Div. 2) - C. Success Rate
PROBLEMSET里面神tm搜不到这题,很迷。所以标题就只好注明比赛出处而没法标明题号了。DescriptionYou are an experienced Codeforces user. Today you found out that during your activity on Codeforces you have made y submissions, out of which x原创 2017-07-11 12:59:20 · 522 阅读 · 0 评论 -
[刷题]Codeforces Round #389(Div. 2) - D. Santa Claus and a Palindrome
DescriptionSanta Claus likes palindromes very much. There was his birthday recently. k of his friends came to him to congratulate him, and each of them presented to him a string si having the same leng原创 2017-07-12 15:56:32 · 551 阅读 · 0 评论 -
[刷题]Google Code Jam 2017 - Round1 C Problem A. Ample Syrup
https://code.google.com/codejam/contest/3274486/dashboardProblemThe kitchen at the Infinite House of Pancakes has just received an order for a stack of K pancakes! The chef currently has N pancakes ava原创 2017-05-01 12:02:04 · 1545 阅读 · 0 评论 -
[刷题]Codeforces 794C - Naming Company
http://codeforces.com/contest/794/problem/CDescriptionOleg the client and Igor the analyst are good friends. However, sometimes they argue over little things. Recently, they started a new company, but原创 2017-05-13 22:04:25 · 1282 阅读 · 0 评论 -
[刷题]Codeforces 786A - Berzerk
http://codeforces.com/problemset/problem/786/ADescriptionRick and Morty are playing their own version of Berzerk (which has nothing in common with the famous Berzerk game). This game needs a huge space原创 2017-04-03 22:05:37 · 669 阅读 · 0 评论 -
[刷题]Codeforces 746G - New Roads
DescriptionThere are n cities in Berland, each of them has a unique id — an integer from 1 to n, the capital is the one with id 1. Now there is a serious problem in Berland with roads — there are no ro原创 2017-03-26 20:25:45 · 947 阅读 · 0 评论 -
[刷题]Codeforces 785D - Anton and School - 2
DescriptionAs you probably know, Anton goes to school. One of the school subjects that Anton studies is Bracketology. On the Bracketology lessons students usually learn different sequences that consist原创 2017-03-21 22:19:30 · 869 阅读 · 0 评论 -
[刷题]算法竞赛入门经典(第2版) 6-9/UVa127 - "Accordian" Patience
题意:52张牌排一行,一旦出现任何一张牌与它左边的第一张或第三张“匹配”,即花色或点数相同,则须立即将其移动到那张牌上面,将其覆盖。能执行以上移动的只有压在最上面的牌。直到最后没有牌能向左移动。 注意细则:如果同时有多张牌都可以移动,你应该采取的策略是移动最左边可移动的牌。当一张牌既可以移动到左边第一张,又可以移动到左边第三张时,应移动到左边第三张上面。代码:(Accepted,0.100s)//原创 2017-01-31 15:25:44 · 483 阅读 · 0 评论 -
[刷题]算法竞赛入门经典(第2版) 4-8/UVa12108 - Extraordinarily Tired Students
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO 代码:(Accepted,0 ms)//UVa12108 - Extraordinarily Tired Students#include<iostream>struct how_cute_my_sleepy_boys_are { int a,//awaken period : a>=1;原创 2016-08-11 11:26:27 · 700 阅读 · 0 评论 -
[刷题]算法竞赛入门经典(第2版) 5-2/UVa1594 - Ducci Sequence
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO代码:(Accepted,20 ms)//UVa1594 - Ducci Sequence#include<iostream>#include<algorithm>#include<cmath>#include<vector>using namespace std;int T,N;bool is_zero(原创 2016-08-18 14:41:26 · 777 阅读 · 0 评论 -
[刷题]Codeforces 811C - Vladik and Memorable Trip
哇咔咔,终于期末考完啦,终于放暑假啦,我终于又有时间学习啦!!(o゜▽゜)o☆DescriptionVladik often travels by trains. He remembered some of his trips especially well and I would like to tell you about one of these trips:Vladik is at init原创 2017-07-04 22:10:27 · 480 阅读 · 0 评论 -
[刷题]算法竞赛入门经典(第2版) 6-11/UVa10410 6-13/UVa215
最近刷题量大,不高兴写题解了。以后算竟的题目可能只是跳着做做了。题目:6-11 UVa10410 - Tree Reconstruction//UVa10410 - Tree Reconstruction//Accepted 0.000s#include<iostream>#include<stack>#include<vector>using namespace std;const i原创 2017-07-06 22:28:54 · 544 阅读 · 0 评论 -
[刷题]Codeforces Round #393(Div. 2) - A. Petr and a calendar
DescriptionPetr wants to make a calendar for current month. For this purpose he draws a table in which columns correspond to weeks (a week is seven consequent days from Monday to Sunday), rows correspo原创 2017-07-20 14:29:16 · 421 阅读 · 0 评论 -
[刷题]HDU3157 - Crazy Circuits & SGU176 - Flow construction (网络流)
两道有上下界有源汇最小流。 步骤之前写的笔记里有。但是原理。。。确实不太懂。 步骤: 1. 按照无源汇有上下界的最大流的做法找出可行流(但不要建立t->s); 2. 添加t->s,流量上界INF; 3. 再次运行最大流,找出ss->st可行流; 4. 若ss不满载,则无可行流。反之,最小流为t->s的流量,每条边的流量为逆向边的流量(加上下界b)。SGU176 - Flow constr原创 2017-10-26 21:57:08 · 659 阅读 · 0 评论 -
[刷题]Codeforces Round #441(Div. 2) - D. Sorting the Coins
DescriptionRecently, Dima met with Sasha in a philatelic store, and since then they are collecting coins together. Their favorite occupation is to sort collections of coins. Sasha likes having things i原创 2017-10-16 22:43:54 · 564 阅读 · 0 评论 -
[刷题]UVA11248 - Frequency Hopping (网络流)
Descriptionuva的pdf格式题目复制有问题,直接贴原题链接了。 UVA11248 - Frequency HoppingKey给一个N点E条边的网络流,问能否找出1->N的一条流量等于C的流。若不能,若修改一条弧的上界,可否找到?列出所有可修改的弧。先求出最大流,若大于C,输出“possible”。 若小于C,枚举修改每一条弧再次运行最大流(记得记录每条修改过的弧,本次最大流运行过后原创 2017-10-22 15:12:50 · 486 阅读 · 0 评论 -
[刷题]UVA11082 - Matrix Decompressing (上下界网络流)
DescriptionUVA11082 - Matrix Decompressing Some RxC matrix of positive integers is encoded and represented by its R cumulative row sum and C column sum entries. Given, R, C and those R+C cumulative ro原创 2017-10-21 20:29:33 · 489 阅读 · 0 评论 -
[刷题]HDU2242 - 考研路茫茫——空调教室 (双连通分量)
Problem Description众所周知,HDU的考研教室是没有空调的,于是就苦了不少不去图书馆的考研仔们。Lele也是其中一个。而某教室旁边又摆着两个未装上的空调,更是引起人们无限YY。 一个炎热的下午,Lele照例在教室睡觉的时候,竟然做起了空调教室的美梦。 Lele梦到学校某天终于大发慈悲给某个教室安上了一个空调。而且建造了了M条通气管道,让整个教学楼的全部教室都直接或间接和空调教室原创 2017-10-27 23:53:01 · 664 阅读 · 0 评论 -
[刷题]2017 ACM Qingdao Online - Brute Force Sorting
2017 ACM-ICPC Asia Regional Qingdao Online - 1010 - Brute Force Sorting(HDU6215)Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 1195 Accepted原创 2017-09-19 22:46:05 · 577 阅读 · 0 评论 -
[刷题]ACM ICPC 2015合肥网络赛 - Removed Interval
Problem DescriptionGiven a sequence of numbers A=a1,a2,…,aN, a subsequence b1,b2,…,bk of A is referred as increasing if b1InputThe first line of input contains a number T indicating the number of test原创 2017-08-07 13:56:47 · 673 阅读 · 0 评论 -
[刷题]2017百度之星资格赛 - 度度熊与邪恶大魔王
Problem Description度度熊为了拯救可爱的公主,于是与邪恶大魔王战斗起来。 邪恶大魔王的麾下有n个怪兽,每个怪兽有a[i]的生命值,以及b[i]的防御力。 度度熊一共拥有m种攻击方式,第i种攻击方式,需要消耗k[i]的晶石,造成p[i]点伤害。 当然,如果度度熊使用第i个技能打在第j个怪兽上面的话,会使得第j个怪兽的生命值减少p[i]-b[j],当然如果伤害小于防御,那么攻击就原创 2017-08-06 12:40:31 · 1299 阅读 · 1 评论 -
[刷题]Codeforces Round #425(Div. 2) - D. Misha, Grisha and Underground
DescriptionMisha and Grisha are funny boys, so they like to use new underground. The underground has n stations connected with n - 1 routes so that each route connects two stations, and it is possible原创 2017-07-25 02:03:56 · 707 阅读 · 0 评论 -
[刷题]Codeforces Round #420(Div. 2) - D. Okabe and City
DescriptionOkabe likes to be able to walk through his city on a path lit by street lamps. That way, he doesn’t get beaten up by schoolchildren.Okabe’s city is represented by a 2D grid of cells. Rows ar原创 2017-07-24 15:07:35 · 491 阅读 · 0 评论 -
[刷题]Codeforces Round #420(Div. 2) - E. Okabe and El Psy Kongroo
DescriptionOkabe likes to take walks but knows that spies from the Organization could be anywhere; that’s why he wants to know how many different walks he can take in his city safely. Okabe’s city can原创 2017-07-22 17:51:58 · 705 阅读 · 0 评论 -
[刷题]算法竞赛入门经典(第2版) 6-14UVa12118 - Inspector's Dilemma
DesicriptionIn a country, there are a number of cities. Each pair of city is connected by a highway, bi-directional of course. A road-inspector s task is to travel through the highways (in either direc原创 2017-07-20 22:02:10 · 521 阅读 · 0 评论 -
[刷题]Codeforces 815A - Karen and Game
千年两小时只写出2题,这次终于把C题写出来了。。。DescriptionOn the way to school, Karen became fixated on the puzzle game on her phone! The game is played as follows. In each level, you have a grid with n rows and m columns.原创 2017-07-08 11:48:39 · 844 阅读 · 0 评论 -
[刷题]算法竞赛入门经典(第2版) 5-1/UVa1593 - Alignment of Code
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO代码:(Accepted,0 ms)//UVa1593 - Alignment of Code#include<iostream>#include<algorithm>#include<vector>#include<string>#include<sstream>#include<iterator>#in原创 2016-08-17 18:10:13 · 631 阅读 · 0 评论 -
[刷题]算法竞赛入门经典(第2版) 4-10/UVa815 - Flooded!
书上具体所有题目:http://pan.baidu.com/s/1hssH0KO代码:(Accepted,0 ms)//UVa815 - Flooded!#include<iostream>#include<algorithm>int M, N, W, S[1000], T = 0;int main(){ //freopen("in.txt", "r", stdin); w原创 2016-08-14 15:20:12 · 1172 阅读 · 1 评论 -
[刷题]算法竞赛入门经典(第2版) 5-6/UVa1595 - Symmetry
题意:平面上给若干点,问它们是不是关于某垂直于x轴的直线对称。代码:(Wrong Answer, –ms)//UVa1595 - Symmetry#include<iostream>#include<vector>#include<algorithm>using namespace std;struct point { int x, y; bool operator <(p原创 2016-08-23 14:35:47 · 847 阅读 · 0 评论 -
[刷题]算法竞赛入门经典(第2版) 5-8/UVa230 - Borrowers
题意:建立一个借书/归还系统。有借、还、把还的书插到书架上这三个指令。代码:(Accepted, 0ms)//UVa230 - Borrowers#include<iostream>#include<string>#include<map>#include<set>using namespace std;struct BOOK { string au, ti; BOOK(c原创 2016-08-27 16:44:16 · 853 阅读 · 0 评论 -
[刷题]算法竞赛入门经典(第2版) 5-7/UVa12100 - Printer Queue
题意:一堆文件但只有一个打印机,按优先级与排队顺序进行打印。也就是在一个可以插队的的队列里,问你何时可以打印到。至于这个插队啊,题目说”Of course, those annoying term papers that others are printing may have to wait for quite some time to get printed, but that’s life.“原创 2016-08-25 15:06:47 · 654 阅读 · 0 评论 -
[刷题]算法竞赛入门经典(第2版) 5-9/UVa1596 - Bug Hunt
//开学了,好烦啊啊啊啊啊!怎么开个学那么多破事情!!都俩星期了,终于有时间写出来一道题 题意:不难理解,不写了。这几天忙的心累。代码:(Accepted, 0.010s)//UVa1596 - Bug Hunt#include<iostream>#include<sstream>#include<string>#include<stack>#include<map>using nam原创 2016-09-13 17:14:51 · 841 阅读 · 0 评论 -
[刷题]算法竞赛入门经典(第2版) 5-13/UVa822 - Queue and A
题意:模拟客服MM,一共有N种话题,每个客服MM支持处理其中的i个(i < N),处理的话题还有优先级。为了简化流程方便出题,设每个话题都是每隔m分钟来咨询一次。现知道每个话题前来咨询的时间、间隔、处理此话题所需的时长与一共有多少次咨询。问多少时间后全部话题处理完成。代码:(Accepted,0.010s)//UVa822 - Queue and A//Accepted 0.010s//#def原创 2016-10-12 14:14:32 · 850 阅读 · 0 评论