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)\), 现 ...
随机推荐
- 第九篇、微信小程序-button组件
主要属性: 注:button-hover 默认为{background-color: rgba(0, 0, 0, 0.1); opacity: 0.7;} 效果图: ml: <!--默认的but ...
- PHP学习笔记 - 入门篇(2)
PHP入门篇(2) 什么是变量 变量是用于存储值的容器,如下 $var = @"6666" 如何定义变量 定义变量就是像服务器的内存申请空间,用来存储数据,eg: <?php ...
- 【原】GO 语言常见错误
1. Scan error on column index 4: converting string "" to a int: strconv.ParseInt: parsing ...
- swing画太极图案源码
package org.open.swing.taiji; /** * @(#)Taichi.java * * * @author * @version 1.00 2007/6/12 */ impor ...
- js 闭包 详解
闭包(closure)是Javascript语言的一个难点,也是它的特色,很多高级应用都要依靠闭包实现. 闭包的特性 闭包有三个特性: 1.函数嵌套函数 2.函数内部可以引用外部的参数和变量 3.参数 ...
- CLR via C# 异常管理读书笔记
1. 设计异常类型层次结构应该浅而宽 2. 注意使用finally块清理资源 3. 不要什么都捕捉 4.得体地从异常中恢复 5.发生不可恢复的异常时回滚部分完成的操作-维持状态 6.隐藏实现细节来维系 ...
- Dapper.ColumnMapper 的使用
using System; using System.Collections.Generic; using System.Data; using System.Data.SqlClient; usin ...
- FFT Golang 实现
最近项目要用到快速傅立叶变换,自己写了个算法,测试了下,性能和精度还可以接受 len,time= 1048576 378.186167ms diff=-0.00000000000225974794 I ...
- Mysql 备份恢复之 Mysqldump 工具
目前正在学习中,看到mysqldump工具导出的数据都是文本形式的,如果是blob或text大对象类型导出的是什么格式的?这个需要后续研究.下面只先总结下简单的. 一.备份1.备份Mysql一个数据库 ...
- 自定义UICollectionViewLayout并添加UIDynamic - scorpiozj(转)
转载自:http://www.tuicool.com/articles/jM77Vf 自定义UICollectionViewLayout并添加UIDynamic UICollectionVie ...