随笔分类 - 其他 贪心
摘要:E. Water Level In recent years John has very successfully settled at his new job at the office. But John doesn't like to idly sit around while his cod
阅读全文
摘要:D2. Optimal Subsequences (Hard Version) This is the harder version of the problem. In this version, 1≤n,m≤2⋅105. You can hack this problem if you lock
阅读全文
摘要:B. Box Permutation p is a sequence of integers p=[p1,p2,…,pn], consisting of n distinct (unique) positive integers between 1 and n, inclusive. For exa
阅读全文
摘要:D. Yet Another Monster Killing Problem You play a computer game. In this game, you lead a party of 𝑚 heroes, and you have to clear a dungeon with 𝑛
阅读全文
摘要:D. Binary String Minimizing You are given a binary string of length n (i. e. a string consisting of n characters '0' and '1'). In one move you can swa
阅读全文
摘要:C. Platforms Jumping There is a river of width n. The left bank of the river is cell 0 and the right bank is cell n+1 (more formally, the river can be
阅读全文
摘要:B. Minimize the Permutation You are given a permutation of length n. Recall that the permutation is an array consisting of n distinct integers from 1
阅读全文
摘要:B. Teams Formation link http://codeforces.com/contest/878/problem/B describe This time the Berland Team Olympiad in Informatics is held in a remote ci
阅读全文
摘要:3709: [PA2014]Bohater 链接 http://www.lydsy.com/JudgeOnline/problem.php?id=3709 题面 在一款电脑游戏中,你需要打败n只怪物(从1到n编号)。为了打败第i只怪物,你需要消耗d[i]点生命值,但怪物死后会掉落血药,使你恢复a[i
阅读全文
摘要:B Balala Power! 题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=6034 题面描述 Talented Mr.Tang has n strings consisting of only lower case characters. He w
阅读全文
摘要:A Hometask 题意:给你一个字符串,然后再给你k个禁止挨在一起的字符串,问你最少删除多少个字符串,使得不会有禁忌的字符串对挨在一起。题目保证每个字符最多出现在一个禁忌中。 题解:由于每个字符只会出现在一个禁忌里面,那么就说明每个询问是独立的。对于每个询问,我们贪心的去处理就好了,就连续的禁忌
阅读全文
摘要:C. Bear and Different Names 题目连接: http://codeforces.com/contest/791/problem/C Description In the army, it isn't easy to form a group of soldiers that
阅读全文
摘要:B. Mahmoud and a Triangle 题目连接: http://codeforces.com/contest/766/problem/B Description Mahmoud has n line segments, the i th of them has length ai. E
阅读全文
摘要:D. Dasha and Very Difficult Problem 题目连接: http://codeforces.com/contest/761/problem/D Description Dasha logged into the system and began to solve prob
阅读全文
摘要:B. Urbanization 题目链接 http://codeforces.com/contest/735/problem/B 题面 Local authorities have heard a lot about combinatorial abilities of Ostap Bender s
阅读全文
摘要:D. Lakes in Berland 题目连接: http://codeforces.com/contest/723/problem/D Description The map of Berland is a rectangle of the size n × m, which consists
阅读全文
摘要:C. Polycarp at the Radio 题目连接: http://codeforces.com/contest/723/problem/C Description Polycarp is a music editor at the radio station. He received a
阅读全文
摘要:C. Sonya and Problem Wihtout a Legend 题目连接: http://codeforces.com/contest/713/problem/C Description Sonya was unable to think of a story for this prob
阅读全文
摘要:D. Generating Sets 题目连接: http://codeforces.com/contest/722/problem/D Description You are given a set Y of n distinct positive integers y1, y2, ..., yn
阅读全文
摘要:D. Maxim and Array 题目连接: http://codeforces.com/contest/721/problem/D Description Recently Maxim has found an array of n integers, needed by no one. He
阅读全文