My issue
I’m failing a single test, but I have no idea why. I’m using a vector to store necessary data and after processing data for one player, I clear the vector. Please help me out!
My code
#include <iostream>
#include <vector>
using namespace std;
int main() {
// your code goes here
int N, M, K, watchHours, total, v;
vector<int> arr;
cin >> N >> M >> K;
for(int i=0; i<N; i++){
for(int j=0; j<K+1; j++){
cin >> v;
arr.push_back(v);
watchHours = watchHours + v;
}
if(arr.at(K)<=10 && watchHours - arr.at(K) >=M){
total++;
}
arr.clear();
}
cout << total << endl;
return 0;
}
Learning course: Level up from 1* to 2*
Problem Link: CodeChef: Practical coding for everyone