codeforces723----C. Polycarp at the Radio】的更多相关文章

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…
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…
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…
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…
这题题意不太好理解,但是可以通过样例推.主要考察思维的全面性,注意把b[m]特殊处理下. AC代码: #include<cstdio> #include<cstring> const int maxn=2000+5; int cnt[maxn],play[maxn]; int main(){ int n,m; scanf("%d%d",&n,&m); memset(cnt,0,sizeof(cnt)); for(int i=1;i<=n;+…
//AC代码...表示很晕 #include <iostream> using namespace std; ],b[]; int main() { int n,m,cnt; cin >> n >> m; int t = n/m; int t2 = n%m; ) cnt = t; ; ; i<n; ++i) { cin >> a[i]; if(a[i] <= m) ++b[a[i]]; && b[a[i]] == cnt) --t…
http://codeforces.com/contest/723/problem/C 题目是给出一个序列 a[i]表示第i个歌曲是第a[i]个人演唱,现在选出前m个人,记b[j]表示第j个人演唱歌曲的数量, 现在你可以改变a[]这个数组,使得前m个人的演唱歌曲的数量的最小值最大. 很明显对于前m个人,每个人唱了多少首是很容易统计出来的,只需要对<=m的人进行统计即可,不用统计>m的,这样的话数组只需开到2000即可. 对于后面的人,可以改变,优先改变前m个人中演唱歌曲最小的那个,这个可以用优…
题意:给定 n 个数,让把某一些变成 1-m之间的数,要改变最少,使得1-m中每个数中出现次数最少的尽量大. 析:这个题差不多读了一个小时吧,实在看不懂什么意思,其实并不难,直接暴力就好,n m不大.很明显最后1-m中次数最长的应该是n/m, 所以我们把大于n/m的都变成小于等于的,把这 n 个数中大于 m 的也变成,但是并不需要都变,只要满足每个数都是大于等于n/m就好了. 代码如下: #pragma comment(linker, "/STACK:1024000000,1024000000&…