当前位置:网站首页>[noip2009 popularization group] score line delimitation
[noip2009 popularization group] score line delimitation
2022-07-06 04:47:00 【Recurss】
Title Description
The selection of Expo volunteers is in progress A The city is in full swing . In order to select the most suitable talents , A A A The city conducted a written test for all the contestants who signed up , Only when the written test score reaches the interview score line can the contestant enter the interview . The interview score line is based on the number of planned applicants 150 % 150\% 150% Delimitation , That is, if you plan to enroll m m m Volunteers , The interview score line is ranked No m × 150 % m \times 150\% m×150%( Rounding down ) The score of the best player , And the final contestants who enter the interview are all the contestants whose written test scores are not lower than the interview score line .
Now please write a program to mark the interview score line , And output all enter the interview of the contestant's registration number and written test results .
Input format
first line , Two integers n , m ( 5 ≤ n ≤ 5000 , 3 ≤ m ≤ n ) n,m(5 ≤ n ≤ 5000,3 ≤ m ≤ n) n,m(5≤n≤5000,3≤m≤n), Separated by a space , among n n n The total number of contestants who signed up for the written examination , m m m The number of volunteers who plan to enroll . Input data guarantee m × 150 % m \times 150\% m×150% Rounded down, less than or equal to n n n.
Line two to line two n + 1 n+1 n+1 That's ok , Each line contains two integers , Separated by a space , They are the registration numbers of the players k ( 1000 ≤ k ≤ 9999 ) k(1000 ≤ k ≤ 9999) k(1000≤k≤9999) And the written test results of the contestant $ s(1 ≤ s ≤ 100)$. The data ensure that the registration numbers of players are different .
Output format
first line , Yes 2 2 2 It's an integer , Separated by a space , The first integer represents the interview score line ; The second integer is the actual number of contestants who entered the interview .
Start with the second line , Each row contains 2 2 2 It's an integer , Separated by a space , The registration number and the written test results of the contestants entering the interview , According to the written test results from high to low output , If the scores are the same , According to the registration number from small to large order output .
Examples #1
The sample input #1
6 3
1000 90
3239 88
2390 95
7231 84
1005 95
1001 88
Sample output #1
88 5
1005 95
2390 95
1000 90
1001 88
3239 88
Tips
【 Sample explanation 】
m × 150 % = 3 × 150 % = 4.5 m \times 150\% = 3 \times150\% = 4.5 m×150%=3×150%=4.5, Round down to 4 4 4. Guarantee 4 4 4 The score line for an individual to enter an interview is 88 88 88, But because 88 88 88 There's heavy division , So all grades are greater than or equal to 88 88 88 All the contestants can enter the interview , So in the end 5 5 5 Individuals enter the interview .
NOIP 2009 Popularization group The second question is
/* * @Description: To iterate is human, to recurse divine. * @Autor: Recursion * @Date: 2022-07-04 18:46:06 * @LastEditTime: 2022-07-05 03:18:13 */
#include <bits/stdc++.h>
#define LL long long
using namespace std;
const int maxn = 1e6 + 10;
const int mod = 1e9 + 7;
const int INF = 1e9 + 10;
const int N = 1e6;
int n;
double m;
int a[N];
struct node{
int k;
int s;
}t[N];
bool cmp(node x,node y){
if(x.s > y.s)
return true;
if(x.s == y.s){
if(x.k < y.k )
return true;
}
return false;
}
int main()
{
ios::sync_with_stdio(false);
cin.tie(0);
cout.tie(0);
cin >> n >> m;
int x;
x = m * 1.5;
for(int i = 1;i <= n;i ++){
cin >> t[i].k >> t[i].s;
}
sort(t + 1, t + 1 + n,cmp);
int num = x;
for(int i = x + 1;i <= n;i ++){
if(t[x].s == t[i].s)
num++;
}
cout << t[x].s << " " << num << endl;
for(int i = 1;i <= x;i ++){
cout << t[i].k <<" "<<t[i].s << endl;
}
for(int i = x + 1;i <= n;i ++){
if(t[x].s == t[i].s)
cout << t[i].k << " " << t[i].s << endl;
}
return 0;
}
边栏推荐
- 2021RoboCom机器人开发者大赛(初赛)
- 动态规划(树形dp)
- Postman测试报告
- Yyds dry goods inventory OSI & tcp/ip
- win10电脑系统里的视频不显示缩略图
- Word cover underline
- The implementation of the maize negotiable digital warehouse receipt standard will speed up the asset digitization process of the industry
- Postman关联
- Platformio create libopencm3 + FreeRTOS project
- 二叉树基本知识和例题
猜你喜欢
比尔·盖茨晒18岁个人简历,48年前期望年薪1.2万美元
[05-1, 05-02, 05-03] network protocol
The implementation of the maize negotiable digital warehouse receipt standard will speed up the asset digitization process of the industry
Introduction of several RS485 isolated communication schemes
Bill Gates posted his 18-year-old resume and expected an annual salary of $12000 48 years ago
acwing周赛58
Crazy God said redis notes
[FreeRTOS interrupt experiment]
canal同步mysql数据变化到kafka(centos部署)
Selection of slow motion function
随机推荐
优秀PM必须经历这3层蜕变!
行业专网对比公网,优势在哪儿?能满足什么特定要求?
Dry goods collection | Vulkan game engine video tutorial
How do programmers teach their bosses to do things in one sentence? "I'm off duty first. You have to work harder."
Jd.com 2: how to prevent oversold in the deduction process of commodity inventory?
[05-1, 05-02, 05-03] network protocol
The most detailed and comprehensive update content and all functions of guitar pro 8.0
Implementation of knowledge consolidation source code 2: TCP server receives and processes half packets and sticky packets
Yyds dry goods inventory OSI & tcp/ip
cdc 能全量拉去oracle 表嘛
你需要知道的 TCP 三次握手
Leetcode 186 Flip the word II in the string (2022.07.05)
[HBZ sharing] how to locate slow queries in cloud database
web工程导入了mysql驱动jar包却无法加载到驱动的问题
2021robocom robot developer competition (Preliminary)
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Introduction of several RS485 isolated communication schemes
Crazy God said redis notes
A blog to achieve embedded entry
Knowledge consolidation source code implementation 3: buffer ringbuffer