RCC 2014 Warmup (Div. 2) ABC
A. Elimination
time limit per test:1 second
memory limit per test:256 megabytes
input:standard input
output:standard output
The finalists of the "Russian Code Cup" competition in 2214 will be the participants who win in one of the elimination rounds.
The elimination rounds are divided into main and additional. Each of the main elimination rounds consists of c problems, the winners of the round are the first n people in the rating list. Each of the additional elimination rounds consists of d problems. The winner of the additional round is one person. Besides, k winners of the past finals are invited to the finals without elimination.
As a result of all elimination rounds at least n·m people should go to the finals. You need to organize elimination rounds in such a way, that at least n·m people go to the finals, and the total amount of used problems in all rounds is as small as possible.
The first line contains two integers c and d (1 ≤ c, d ≤ 100) — the number of problems in the main and additional rounds, correspondingly. The second line contains two integers n and m (1 ≤ n, m ≤ 100). Finally, the third line contains an integer k (1 ≤ k ≤ 100) — the number of the pre-chosen winners.
In the first line, print a single integer — the minimum number of problems the jury needs to prepare.
1 10
7 2
1
2
2 2
2 1
2
0
题意 :淘汰赛分为主赛和附加赛,主赛一轮有c道题,附加赛一轮有d道题,主赛每轮可以选拔出n个人,附加赛每次可以选出1个人,还有k个人不用参加淘汰赛,要求最后要选出m×n个人主办方需要准备的最少的题目是多少。
#include <stdio.h>
#include <string.h>
#include <iostream> using namespace std ; int main()
{
int c,d ;
int n,m ;
int k ;
while(~scanf("%d %d",&c,&d))
{
scanf("%d %d %d",&n,&m,&k) ;
if(n * m - k <= )
{
printf("0\n") ;
continue ;
}
int a = n*m-k ;
int ans = ;
if(c < d*n)
{
int x = a / n ;
ans += x*c ;
int y = a % n ;
ans += min(c,d*y) ;
}
else
ans = a * d ;
printf("%d\n",ans) ;
}
return ;
}
B. Crash
time limit per test:1 second
memory limit per test:256 megabytes
input:standard input
output:standard output
During the "Russian Code Cup" programming competition, the testing system stores all sent solutions for each participant. We know that many participants use random numbers in their programs and are often sent several solutions with the same source code to check.
Each participant is identified by some unique positive integer k, and each sent solution A is characterized by two numbers: x — the number of different solutions that are sent before the first solution identical to A, and k — the number of the participant, who is the author of the solution. Consequently, all identical solutions have the same x.
It is known that the data in the testing system are stored in the chronological order, that is, if the testing system has a solution with number x (x > 0) of the participant with number k, then the testing system has a solution with number x - 1 of the same participant stored somewhere before.
During the competition the checking system crashed, but then the data of the submissions of all participants have been restored. Now the jury wants to verify that the recovered data is in chronological order. Help the jury to do so.
The first line of the input contains an integer n (1 ≤ n ≤ 105) — the number of solutions. Each of the following n lines contains two integers separated by space x and k (0 ≤ x ≤ 105; 1 ≤ k ≤ 105) — the number of previous unique solutions and the identifier of the participant.
A single line of the output should contain «YES» if the data is in chronological order, and «NO» otherwise.
2
0 1
1 1
YES
4
0 1
1 2
1 1
0 2
NO
4
0 1
1 1
0 1
0 2
YES
题意 :每一个上交的答案都有两个标志,x和k,代表k这个人交的第x个不一样的答案,然后给你n个x和k,问你是不是按照时间排得序,而这个按照时间排序的要求就是对于每一个大于0的x,都要求在前边出现过同一个人交过的x-1.否则输出NO
#include <stdio.h>
#include <string.h>
#include <iostream> using namespace std ; int a[] ;
int main()
{
int n,x,k ;
while(~scanf("%d",&n))
{
bool flag = false ;
memset(a,-,sizeof(a)) ;
for(int i = ; i <= n ; i++)
{
scanf("%d %d",&x,&k) ;
if(a[k] == x-)
a[k]++ ;
else if(a[k] < x-)
flag = true ;
}
if(flag) printf("NO\n") ;
else printf("YES\n") ;
}
return ;
}
C. Football
time limit per test:1 second
memory limit per test:256 megabytes
input:standard input
output:standard output
One day, at the "Russian Code Cup" event it was decided to play football as an out of competition event. All participants was divided inton teams and played several matches, two teams could not play against each other more than once.
The appointed Judge was the most experienced member — Pavel. But since he was the wisest of all, he soon got bored of the game and fell asleep. Waking up, he discovered that the tournament is over and the teams want to know the results of all the matches.
Pavel didn't want anyone to discover about him sleeping and not keeping an eye on the results, so he decided to recover the results of all games. To do this, he asked all the teams and learned that the real winner was friendship, that is, each team beat the other teams exactly k times. Help Pavel come up with chronology of the tournir that meets all the conditions, or otherwise report that there is no such table.
The first line contains two integers — n and k (1 ≤ n, k ≤ 1000).
In the first line print an integer m — number of the played games. The following m lines should contain the information about all the matches, one match per line. The i-th line should contain two integers ai and bi (1 ≤ ai, bi ≤ n; ai ≠ bi). The numbers ai and bi mean, that in the i-th match the team with number ai won against the team with number bi. You can assume, that the teams are numbered from1 to n.
If a tournir that meets the conditions of the problem does not exist, then print -1.
3 1
3
1 2
2 3
3 1
题意 :就是n个队,每个队都刚好赢了其他队k次,当然,人两个队打比赛都不能超过两次。输出两个队的对号,前者赢了后者。
#include <iostream>
#include <stdio.h>
#include <string.h> using namespace std; int main()
{
int n ,k;
while(scanf("%d %d",&n,&k) != EOF)
{
if(k* >= n)
{
printf("-1\n") ;
continue ;
}
printf("%d\n",n*k) ;
for(int i = ; i <= n ; i++)
for(int j = i+ ; j <= i+k ; j++)
printf("%d %d\n",i,(j-) % n+) ;
}
return ;
}
RCC 2014 Warmup (Div. 2) ABC的更多相关文章
- RCC 2014 Warmup (Div. 2)
一场很很多HACK的比赛,PREtest太弱了,真的很多坑!平时练习的时候很少注意这些东西了! A:开始一直在模拟,后来发现自己的思路逻辑很乱,果然做比赛不给力! 直接在代码中解释了 #include ...
- RCC 2014 Warmup (Div. 2) A~C
近期CF的pretext真是一场比一场弱.第一次在CF上被卡cin.cout.... A. Elimination time limit per test 1 second memory limit ...
- RCC 2014 Warmup (Div. 1)
A 暴力 #include <iostream> #include<cstdio> #include<cstring> #include<algorithm& ...
- RCC 2014 Warmup (Div. 2) 蛋疼解题总结
A. Elimination time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Codeforces Round #366 (Div. 2) ABC
Codeforces Round #366 (Div. 2) A I hate that I love that I hate it水题 #I hate that I love that I hate ...
- Codeforces Round #247 (Div. 2) ABC
Codeforces Round #247 (Div. 2) http://codeforces.com/contest/431 代码均已投放:https://github.com/illuz/Wa ...
- Codeforces Round #312 (Div. 2) ABC题解
[比赛链接]click here~~ A. Lala Land and Apple Trees: [题意]: AMR住在拉拉土地. 拉拉土地是一个很漂亮的国家,位于坐标线.拉拉土地是与著名的苹果树越来 ...
- Codeforces Round #419 (Div. 2) ABC
python 2.7,用来熟悉Python 由于都是智障题,所以我也不讲述题意和题解,直接贴代码了-- A import sys h,m = map(int,raw_input().split(&qu ...
- Lyft Level 5 Challenge 2018 - Final Round (Open Div. 2)---ABC
A---The King's Race http://codeforces.com/contest/1075/problem/A 题意: 一个人在\((1,1)\), 一个人在\((n,n)\), 现 ...
随机推荐
- The influence of informal governance mechanisms on knowledge integration
Title:The influence of informal governance mechanisms on knowledge integration within cross-function ...
- UVaLive 3708
题意:周长为10000的圆上等距分布n个雕塑,求再加入m个雕塑后,为使所有雕塑等距分布所需移动原来n个雕塑的最小总距离. 分析:计算相对距离. #include<cstdio> #incl ...
- GDI+
1, 编译error的话一般是却 #include <comdef.h>#include <Windows.h> Windows.h内会包含Windows.h,但是因为在std ...
- How to Set Directory Permissions at Install Time using an MSI Created Using Windows Installer XML (WIX)
Original Link: http://blogs.msdn.com/b/cjacks/archive/2008/12/04/how-to-set-directory-permissions-a ...
- 串操作,C++实现
对串的基本操作都全已经实现 对kmp,kf字符串替换等功能全都已经实现 由于时间原因.没来得及注释,希望大家参考见谅. 串操作hstring.h头文件实现 //kallen 1 #ifndef _HS ...
- input内容改变触发事件,兼容IE
<html> <head> <script type="text/javascript"> window.onload = function() ...
- 纯JS焦点图特效(可一个页面多用)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- C# Json数据反序列化为Dictionary并根据关键字获取指定值1
Json数据: { "dataSet": { "header": { "returnCode": "0", " ...
- js中使用使用原型(prototype)定义方法的好处
经常在前端面试或是和其他同行沟通是,在谈到构造在JS定义构造函数的方法是最好使用原型的方式:将方法定义到构造方法的prototype上,这样的好处是,通过该构造函数生成的实例所拥有的方法都是指向一个函 ...
- [译]深入理解JVM
深入理解JVM 原文链接:http://www.cubrid.org/blog/dev-platform/understanding-jvm-internals 每个使用Java的开发者都知道Java ...