A candidate is doing an interview. He was given N problems, and you know how much time he took for each problem, or that he didn’t solve it. If he solved less than half the problems, he’s rejected. Otherwise, if he solved one of the problems in more than K seconds, he’s too slow. If he solved all the problems, and in at most 1 second each, he’s a bot. If none of that happens, he’s accepted. Determine which one he is.
using namespace std;
int cnt=0,mx=0; //number of problems solved and max time among solved problems
for (int i=0;i<n;i++)
else if (mx>k)
else if (bot)
It is giving WA because the condition for checking Bot is wrong . Problem Statement says for Bot
“candidate has solved all of the N problems in at most one second each”. So if array contain “0 1 1 2” it shouldn’t return Bot ,but in your code it is.