CodeForces 413A Data Recovery
来源:互联网 发布:淘宝无法举证 编辑:程序博客网 时间:2024/06/05 15:24
Not so long ago company R2 bought company R1 and consequently, all its developments in the field of multicore processors. Now the R2 laboratory is testing one of the R1 processors.
The testing goes in n steps, at each step the processor gets some instructions, and then its temperature is measured. The head engineer in R2 is keeping a report record on the work of the processor: he writes down the minimum and the maximum measured temperature in his notebook. His assistant had to write down all temperatures into his notebook, but (for unknown reasons) he recorded onlym.
The next day, the engineer's assistant filed in a report with all the m temperatures. However, the chief engineer doubts that the assistant wrote down everything correctly (naturally, the chief engineer doesn't doubt his notes). So he asked you to help him. Given numbersn, m,min, max and the list ofm temperatures determine whether you can upgrade the set ofm temperatures to the set of n temperatures (that is add n - m temperatures), so that the minimum temperature wasmin and the maximum one was max.
The first line contains four integers n, m, min, max(1 ≤ m < n ≤ 100; 1 ≤ min < max ≤ 100). The second line containsm space-separated integers ti (1 ≤ ti ≤ 100) — the temperatures reported by the assistant.
Note, that the reported temperatures, and the temperatures you want to add can contain equal temperatures.
If the data is consistent, print 'Correct' (without the quotes). Otherwise, print 'Incorrect' (without the quotes).
2 1 1 21
Correct
3 1 1 32
Correct
2 1 1 32
Incorrect
In the first test sample one of the possible initial configurations of temperatures is [1, 2].
In the second test sample one of the possible initial configurations of temperatures is [2, 1, 3].
In the third test sample it is impossible to add one temperature to obtain the minimum equal to 1 and the maximum equal to 3.
#include<iostream>#include<algorithm>using namespace std;int main(){ int n,m,mymax,mymin,num[110],x; while(cin>>n>>m>>mymin>>mymax){ for(int i=0;i<m;i++){ cin>>num[i]; } sort(num,num+m);if(num[0]<mymin||num[m-1]>mymax){cout<<"Incorrect"<<endl;continue;}x=2;if(mymax==mymin){ x--; } if(num[0]==mymin){ x--; }if(num[m-1]==mymax){ x--;}if(x<=n-m){ cout<<"Correct"<<endl;}else{ cout<<"Incorrect"<<endl;} } return 0;}
- CodeForces 413A Data Recovery
- CodeForces 413A Data Recovery
- Codeforces 413A Data Recovery(水题)
- Data Recovery and High Availability 之 Chapter 1. Developing a Good Backup and Recovery
- CodeForces 360A - Levko and Array Recovery (思维)
- CodeForces 360A - Levko and Array Recovery【动规】
- 记某次codeforces考试 A. Levko and Array Recovery
- Micro Drive Data Recovery
- Formatted data recovery
- Remove Data Recovery Scareware
- Hetman Data Recovery Products
- Data Recovery Advisor
- Data Recovery Advisor
- Data Recovery Advisor
- TwinDB data recovery toolkit
- 34 Identify two situations in which you can use Data Recovery Advisor for recovery. (Choose two.) A.
- CodeForces 360A - Levko and Array Recovery 给出操作求原始数列
- CF-Codeforces Round #210 (Div. 1)-A-Levko and Array Recovery
- Android一步一步带你实现RecyclerView的拖拽和侧滑删除功能
- Java并发多线程面试题 Top 50
- html-手机端-点击按钮-去高亮-加点击效果
- freemarker+poi 模板生成 word添加图片
- 分析URL Routing和URL Rewriting两者之间的不同
- CodeForces 413A Data Recovery
- android 对话框(二)Dialog列表
- php中echo等语言结构与函数差异
- 在IntelliJ上操作GitHub
- 静态资源库CDN服务
- C++ 强制转换函数const_cast,reinterpret_cast,static_cast,dynamic_cast
- md5密码加盐
- 6.有关802.11b物理头:preamble部分
- Spring学习笔记---2.2-基于注解的配置