CodeForces 413A Data Recovery

CodeForces 413A  Data Recovery

Time Limit:1000MS     Memory Limit:262144KB     64bit IO Format:%I64d & %I64u

Description

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 only m.

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 numbers n,mminmax and the list of m temperatures determine whether you can upgrade the set of m temperatures to the set of n temperatures (that is add n - m temperatures), so that the minimum temperature was min and the maximum one was max.

Input

The first line contains four integers n, m, min, max(1 ≤ m < n ≤ 100; 1 ≤ min < max ≤ 100). The second line contains m 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.

Output

If the data is consistent, print 'Correct' (without the quotes). Otherwise, print 'Incorrect' (without the quotes).

Sample Input

Input
2 1 1 2
1
Output
Correct
Input
3 1 1 3
2
Output
Correct
Input
2 1 1 3
2
Output
Incorrect

Hint

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<stdio.h>
int main(){
	int i,n,m,min,max,flag,flag1,flag2,s;
	while(scanf("%d%d%d%d",&n,&m,&min,&max)!=EOF){
		flag1=0;flag2=0;flag=0;
		for(i=0;i<m;i++){
			scanf("%d",&s);
			if(s==min){
				flag1=1;
			}
			if(s==max){
				flag2=1;
			}
			if(s>max||s<min){
				flag=1;
			}
		}
		if(flag==1){
			printf("Incorrect\n");
			continue;
		}
		if(flag1==1&&flag2==1){
			printf("Correct\n");
		}
		else if((flag1==1||flag2==1)&&(n-m>0)){
			printf("Correct\n");
		}
		else if(n-m>=2){
			printf("Correct\n");
		}
		else{
			printf("Incorrect\n");
		}
	}
	return 0;
}



  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值