随笔分类 - 动态规划
摘要:B. Glass Half Spilled There are 𝑛 glasses on the table numbered 1,…,𝑛. The glass 𝑖 can hold up to 𝑎𝑖 units of water, and currently contains 𝑏𝑖
阅读全文
摘要:D. Cakes for Clones You live on a number line. You are initially (at time moment 𝑡=0) located at point 𝑥=0. There are 𝑛 events of the following typ
阅读全文
摘要:看错题系列 cf622C C2. Skyscrapers (hard version) 看成了 对于所有的i不能满足a[i 1] a[i]&&a[i] using namespace std; const int maxn = 5e5+7; int n,m[maxn]; long long ans,
阅读全文
摘要:F. Economic Difficulties An electrical grid in Berland palaces consists of 2 grids: main and reserve. Wires in palaces are made of expensive material,
阅读全文
摘要:F2. Wrong Answer on test 233 (Hard Version) Your program fails again. This time it gets "Wrong answer on test 233" . This is the harder version of the
阅读全文
摘要:E. The Contest A team of three programmers is going to play a contest. The contest consists of 𝑛 problems, numbered from 1 to 𝑛. Each problem is pri
阅读全文
摘要:A. Ivan the Fool and the Probability Theory Recently Ivan the Fool decided to become smarter and study the probability theory. He thinks that he under
阅读全文
摘要:C. Sum Balance Ujan has a lot of numbers in his boxes. He likes order and balance, so he decided to reorder the numbers. There are 𝑘 boxes numbered f
阅读全文
摘要:E. Yet Another Division Into Teams There are n students at your university. The programming skill of the i th student is ai. As a coach, you want to d
阅读全文
摘要: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
阅读全文
摘要:F. Daniel and Spring Cleaning While doing some spring cleaning, Daniel found an old calculator that he loves so much. However, it seems like it is bro
阅读全文
摘要:E. Hyakugoku and Ladders Hyakugoku has just retired from being the resident deity of the South Black Snail Temple in order to pursue her dream of beco
阅读全文
摘要:C. Constanze's Machine Constanze is the smartest girl in her village but she has bad eyesight. One day, she was able to invent an incredible machine!
阅读全文
摘要:E. Rock Is Push You are at the top left cell (1,1) of an n×m labyrinth. Your goal is to get to the bottom right cell (n,m). You can only move right or
阅读全文
摘要:F. Bits And Pieces 题面 You are given an array 𝑎 of 𝑛 integers. You need to find the maximum value of 𝑎𝑖|(𝑎𝑗&𝑎𝑘) over all triplets (𝑖,𝑗,𝑘) su
阅读全文
摘要:D. Yet Another Subarray Problem You are given an array and two integers and . You can choose some subarray $a_l, a_{l+1
阅读全文
摘要:A Buying A House 题意:给你n个房间,妹子住在第m个房间,你有k块钱,你想买一个离妹子最近的房间。其中相邻的房间之间距离为10,a[i]=0表示已经被别人买了。 题解:扫一遍更新答案即可。 include using namespace std; const int maxn = 1
阅读全文
摘要:Anastasia and pebbles 题意:你有两种框,每个框可以最多装k重量的物品,但是你每个框不能装不一样的物品。现在地面上有n个物品,问你最少多少次,可以把这n个物品全部装回去。 题解:其实就是问你得用多少次框,然后把多少次除以2就好了。每次装k的物品装回去就好了。 代码: includ
阅读全文
摘要:A. Berzerk 题目连接: http://codeforces.com/contest/786/problem/A Description Rick and Morty are playing their own version of Berzerk (which has nothing in
阅读全文
摘要:C. Mahmoud and a Message 题目连接: http://codeforces.com/contest/766/problem/C Description Mahmoud wrote a message s of length n. He wants to send it as a
阅读全文