题目链接:C - Final Day (atcoder.jp)

Problem Statement

N students are taking a 4-day exam.

There is a 300-point test on each day, for a total of 1200 points.

The first three days of the exam are already over, and the fourth day is now about to begin. The i-th student (1≤i≤N) gotPi,j​ points on the j-th day (1≤j≤3).

For each student, determine whether it is possible that he/she is ranked in the top K after the fourth day.
Here, the rank of a student after the fourth day is defined as the number of students whose total scores over the four days are higher than that of the student, plus 1.

Constraints

  • 1≤K≤N≤105
  • 0≤Pi,j​≤300(1≤i≤N,1≤j≤3)
  • All values in input are integers.

Input

Input is given from Standard Input in the following format:

N K
P1,1​ P1,2​ P1,3​
...
PN,1​ PN,2​ PN,3​

Output

Print N lines. The i-th line (1≤i≤N) should contain Yes if it is possible that the i-th student is ranked in the top K after the fourth day, and No otherwise.


Sample Input 1 Copy

3 1
178 205 132
112 220 96
36 64 20

Sample Output 1 Copy

Yes
Yes
No

If every student scores 100 on the fourth day, the 1-st student will rank 1-st.
If the 2-nd student scores 100 and the other students score 0 on the fourth day, the 2-nd student will rank 1-st.
The 3-rd student will never rank 1-st.


Sample Input 2 Copy

2 1
300 300 300
200 200 200

Sample Output 2 Copy

Yes
Yes

Sample Input 3 Copy

4 2
127 235 78
192 134 298
28 56 42
96 120 250

Sample Output 3 Copy

Yes
Yes
No
Yes

题意:有n个人参加4场比赛,告诉你前三场比赛的得分(0 - 300),问第四场比完后每一个人有没有成为前k名的可能

思路:我们先计算出每个人已有的总分,然后记录下第k个的成绩,然后判断每个人加上300后分数是否大于那个成绩,如果大于等于就是输出Yes,否则No(因为对于每一个人我们可以假设第四场就他拿了300分,其他人都是0分,那么这样子就是最大可能)

#include<bits/stdc++.h>
using namespace std;int arr[100005];
int b[100005];//用来查找第k个人的成绩 bool cmp(int a, int b){return a > b;
} int main(){int n, k;while(cin >> n >> k){int a;for(int i = 1; i <= n; i++){arr[i] = 0;b[i] = 0;for(int j = 0; j < 3; j++){cin >> a;arr[i] += a;b[i] += a;}}sort(b + 1, b + n + 1, cmp);int ans = b[k];//记录第k个人的成绩for(int i = 1; i <= n; i++){if(arr[i] + 300 >= ans){cout << "Yes" << endl;}else{cout << "No" << endl; }}}return 0;
}

Atcoder TOYOTA SYSTEMS Programming Contest 2021(AtCoder Beginner Contest 228) C - Final Day相关推荐

  1. Atcoder TOYOTA SYSTEMS Programming Contest 2021(AtCoder Beginner Contest 228) B - Takahashi‘s Secret

    题目链接:B - Takahashi's Secret (atcoder.jp) Problem Statement Takahashi has N friends. They have nickna ...

  2. Caddi Programming Contest 2021(AtCoder Beginner Contest 193) 题解

    Caddi Programming Contest 2021(AtCoder Beginner Contest 193) A - Discount 打折浮点数除即可 B - Play Snuke 枚举 ...

  3. NOMURA Programming Contest 2021(AtCoder Regular Contest 121)

    文章目录 A - 2nd Greatest Distance B - RGB Matching C - Odd Even Sort D - 1 or 2 E - Directed Tree F - L ...

  4. TOYOTA SYSTEMS Programming Contest 2021(AtCoder Beginner Contest 228) ABCD

    A 题意: 有一个开关,每天s点开,t点关(可能在第2天或第n天),判断x点时开着还是关着. 思路: 按照是否需要隔夜分个类. #include<bits/stdc++.h> using ...

  5. NEC Programming Contest 2021(AtCoder Beginner Contest 229) B - Hard Calculation

    题目链接:B - Hard Calculation (atcoder.jp) Problem Statement You are given positive integers A and B. Le ...

  6. KYOCERA Programming Contest 2021 (AtCoder Beginner Contest 200) A~E 题解

    ABC200/KYOCERA2021 A~E [A - Century](https://atcoder.jp/contests/abc200/tasks/abc200_a) 题目大意 输入格式 输出 ...

  7. Mynavi Programming Contest 2021 (AtCoder Beginner Contest 201) A~E 题解

    ABC201/Mynavi2021 A~E [A - Tiny Arithmetic Sequence](https://atcoder.jp/contests/abc201/tasks/abc201 ...

  8. NEC Programming Contest 2021 (AtCoder Beginner Contest 229)

    终于开始补提了 重点 : C, E的倒着算, F的染色,G的相邻的转换: B - Hard Calculation #include <iostream> #include <alg ...

  9. Caddi Programming Contest 2021(AtCoder Beginner Contest 193) F.Zebraness

    题目链接 Problem Statement We have a grid with N horizontal rows and N vertical columns. Let (i,j) denot ...

最新文章

  1. java随机生成不重复的数组_Java生成不重复的随机数组的方法
  2. Java接收多台设备发送消息_FCM(Firebase Cloud 消息传递)发送到多个设备
  3. webpack + react 使用 eslint
  4. vba读取csv文件到excel_利用VBA打开顺序文件,并读取
  5. 前台模板 海豚php_GitHub - cbw1820446/DolphinPHP: 海豚PHP——快速开发框架(基于ThinkPHP5.0.3)...
  6. 这是我的C语言入门笔记。
  7. 故乡与文学:一场别开生面的跨年代文学对话(一)
  8. create_workqueue和create_singlethread_workqueue【转】
  9. mysql死锁查询_Mysql 查看死锁,解除死锁 方式
  10. 870C. Maximum splitting
  11. python可变参数函数二阶导数公式_python中函数的可变参数
  12. 1.8 编程基础之多维数组 04 错误探测 python
  13. postgresql 使用pg_restore时显示role root does not exist的解决办法
  14. keras 升级_如何入门Keras?
  15. OmniPlayer for Mac(全能视频播放器)中文版
  16. linux 修改时间 date
  17. 为什么图片保存类型360 se html document,360安全浏览器为什么图片不显示保存
  18. 关于netty的中nettyio.netty.util.IllegalReferenceCountException: refCnt: 0, decrement: 1异常排除
  19. Linux命令分隔符
  20. 算POTCAR要上心!

热门文章

  1. 又一次移植最新lvgl8到esp32的踩坑记录
  2. 免费java视频教程大全在线观看
  3. Socket网络编程面试题
  4. mysql错误#1265
  5. imgaug数据增强库使用
  6. c#在output窗口输出调试信息
  7. mysql 基于idb文件恢复数据
  8. 修改系统文件更改权限
  9. RISC-V指令集架构特点及其总结
  10. setTimeout理解