My issue
what’s wrong with my code
My code
#include <iostream>
using namespace std;
int main() {
int n,h,x;
cin>>n>>h>>x;
int tym[n];
for(int i=0;i<n;i++){
cin>>tym[i];
}
int j=1;
while(j<n){
for(int i=0;i<n-j;i++){
if(tym[j]<tym[j+1]){
int temp=tym[j];
tym[j]=tym[j+1];
tym[j+1]=temp;
}
}
j++;
}
int reqd= h-x;
if(tym[n-1]>=reqd){
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
return 0;
}
Problem Link: NOTIME Problem - CodeChef