My issue
the compiler is not showing the correct outputs… i’ve written the correct code which works on both the online compiler and visual studio
My code
#include <iostream>
using namespace std;
int main() {
// your code goes here
int t;
std::cin >> t;
while(t--){
int n,k;
std::cin >> n >>k;
int sum=0;
int a[n];
int y=1;
for (int i = 0; i < n; i++) {
/* code */
std::cin >> a[i];
sum+=a[i];
if(sum>=k){
sum=sum-k;
}
else{
std::cout <<"NO "<< i+1 << std::endl;
y++;
break;
}
}
if(y==1){
std::cout << "yes" << std::endl;
}
}
return 0;
}
Problem Link: DIET Problem - CodeChef