A - Happy Birthday, Polycarp!】的更多相关文章

Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the numbers from 1 to m, but he d…
Description Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, ..., an, where ai is a band, which performs the i-th song. Polycarp likes bands with the numbers from 1 to…
C. Polycarp at the Radio time limit per test: 2 seconds memory limit per test: 256 megabytes input: standard input output: standard output Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented a…
C. Polycarp at the Radio time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a…
题目链接: 题目 F. Polycarp and Hay time limit per test: 4 seconds memory limit per test: 512 megabytes input: standard input output: standard output 问题描述 The farmer Polycarp has a warehouse with hay, which can be represented as an n × m rectangular table,…
Polycarp's problems time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp is an experienced participant in Codehorses programming contests. Now he wants to become a problemsetter. He se…
B. Polycarp and Letters time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase an…
Description Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters. Let A be a set of positions in the string. Let's call it pretty if following conditions are met…
Polycarp has recently got himself a new job. He now earns so much that his old wallet can't even store all the money he has. Berland bills somehow come in lots of different sizes. However, all of them are shaped as rectangles (possibly squares). All…
861D - Polycarp's phone book 思路:用map做的话,只能出现一次循环,否则会超时. 代码: #include<bits/stdc++.h> using namespace std; #define f first #define s second #define pb push_back #define mp make_pair map<string,int> ma; ]; int main(){ int n; string s,nu; cin>&…
D. Polycarp's Picture Gallery time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp loves not only to take pictures, but also to show his photos to friends. On his personal website he h…
Description Polycarp loves lowercase letters and dislikes uppercase ones. Once he got a string s consisting only of lowercase and uppercase Latin letters. Let A be a set of positions in the string. Let's call it pretty if following conditions are met…
F. Polycarp and Hay 题目连接: http://www.codeforces.com/contest/659/problem/F Description The farmer Polycarp has a warehouse with hay, which can be represented as an n × m rectangular table, where n is the number of rows, and m is the number of columns…
今天佛了,魔鬼周一,在线教学,有点小累,但还好,今天AC了一道,每日一道,还好达成目标,还以为今天完不成了,最近任务越来越多,如何高效完成该好好思考一下了~最重要的还是学业的复习和预习. 今日兴趣新闻: <流浪地球>中的逃生气囊球和马斯克有什么关系? 链接:https://mbd.baidu.com/newspage/data/landingsuper?context=%7B%22nid%22%3A%22news_8599496962815210358%22%7D&n_type=0&a…
Polycarp is practicing his problem solving skill. He has a list of n problems with difficulties a1,a2,-,an, respectively. His plan is to practice for exactly k days. Each day he has to solve at least one problem from his list. Polycarp solves the pro…
Polycarp has nn coins, the value of the ii-th coin is aiai. Polycarp wants to distribute all the coins between his pockets, but he cannot put two coins with the same value into the same pocket. For example, if Polycarp has got six coins represented a…
题目链接: F. Polycarp and Hay time limit per test 4 seconds memory limit per test 512 megabytes input standard input output standard output The farmer Polycarp has a warehouse with hay, which can be represented as an n × m rectangular table, where n is t…
E - Polycarp and Snakes 题意:在一个全是点的图上开始画线,每次将一行或一列任意长度染成字母,一笔染一种字母,字母必须从a开始连续到后面某个字母可以覆盖. 问所给图案是否满足 ,若满足输出它画了几个字母,然后输出这每个字母开始和截止画的横纵坐标. 思路:存图,模拟,用个x1,x2,y1,y2记录每个字母出现位置的最小最大的横纵坐标,对于每个字母如果它的x1,x2,y1,y2不是初始值的话,那么它在图上就出现过(没有被覆盖掉),那么这个字母必然满足,x1==x2||y1==y…
链接 Codeforces 659F Polycarp and Hay 题意 一个矩阵,减小一些数字的大小使得构成一个连通块的和恰好等于k,要求连通块中至少保持一个不变 思路 将数值从小到大排序,按顺序把与其相邻的加到并查集中.记录当前并查集中的个数,如果当前值能被K整除且总和超过了K,那么就可以以该点为中心输出了. 代码 #include <iostream> #include <cstdio> #include <vector> #include <stack…
time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Polycarp is a music editor at the radio station. He received a playlist for tomorrow, that can be represented as a sequence a1, a2, -, an, where…
time limit per test4 seconds memory limit per test512 megabytes inputstandard input outputstandard output The farmer Polycarp has a warehouse with hay, which can be represented as an n × m rectangular table, where n is the number of rows, and m is th…
Polycarp and Div 3 time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Polycarp likes numbers that are divisible by 3. He has a huge number ss. Polycarp wants to cut from it the maximum number…
Codeforces Round #606 (Div. 2, based on Technocup 2020 Elimination Round 4) A. Happy Birthday, Polycarp! time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output Hooray! Polycarp turned nn years old…
Description An array of integers p1,p2,…,pnp1,p2,…,pn is called a permutation if it contains each number from 11 to nn exactly once. For example, the following arrays are permutations: [3,1,2][3,1,2] , [1][1] , [1,2,3,4,5][1,2,3,4,5] and [4,3,1,2][4,…
链接: https://codeforces.com/contest/1185/problem/B 题意: Methodius received an email from his friend Polycarp. However, Polycarp's keyboard is broken, so pressing a key on it once may cause the corresponding symbol to appear more than once (if you press…
B. Email from Polycarp time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output Methodius received an email from his friend Polycarp. However, Polycarp's keyboard is broken, so pressing a key on it…
题目链接:http://codeforces.com/contest/727/problem/F 题目大意:有n个问题,每个问题有一个价值ai,一开始的心情值为q,每当读到一个问题时,心情值将会加上该问题的价值.问题只能按顺序读.有m个询问,求当q=bi时,至少要删去多少个问题才能使得在任何时候心情值都>=0 参考这篇:http://blog.csdn.net/aufeas/article/details/53031439 解法一: 贪心 分别求出最多删去i个问题需要的初始心情值的最小值f[i]…
n个数,用最少的次数来改变数字,使得1到m出现的次数的最小值最大.输出最小值和改变次数以及改变后的数组. 最小值最大一定是n/m,然后把可以改变的位置上的数变为需要的数. http://codeforces.com/problemset/problem/723/C Examples input 4 21 2 3 2 output 2 11 2 1 2 input 7 31 3 2 2 2 2 1 output 2 11 3 3 2 2 2 1 input 4 41000000000 100 7…
Description 有一个长度为 \(n\) 有正负权值的序列,你一开始有一个值,每次到一个权值就加上,最少需要删掉多少数值才能到序列末尾.\(n \leqslant 750,m \leqslant 2 \times 10^5\) Sol DP+二分. 发现这个东西有后效性,就是前面选不选会影响后面的决策,并且权值太大无法记录. 但是我们可以倒着做,因为后面的决策无法影响前面的决策. \(f[i][j]\) 表示到 \(i\) 删掉 \(j\) 个至少需要的初始权值. 因为初始权值非负,所以…
题目链接 遍历每个点, 如果这个点的值能被k整除并且k/a[i][j]后小于等于n*m, 那么就对这个点进行搜索. 将这个点加入队列, 将周围的所有大于等于这个点的值的点也加入队列. 不断重复, 直到队列空或者数量满足要求. 可以加一个额外的数组, 如果搜索的过程中, 这个值和a[i][j]相同, 那么就把这个格子标记, 减少额外的操作. #include <iostream> #include <vector> #include <cstdio> #include &…