PROBLEM LINK:
Practice
Div-2 Contest
Div-1 Contest
Author: Smit Mandavia
Tester: Rahul Dugar
Editorialist: Mohammed Ehab
DIFFICULTY:
CAKEWALK
PREREQUISITES:
None
PROBLEM:
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.
SOLUTIONS:
Editorialist's Solution
#include <bits/stdc++.h>
using namespace std;
int main()
{
int t;
scanf("%d",&t);
while (t--)
{
int n,k;
scanf("%d%d",&n,&k);
int cnt=0,mx=0; //number of problems solved and max time among solved problems
bool bot=1;
for (int i=0;i<n;i++)
{
int a;
scanf("%d",&a);
if (a!=-1)
{
cnt++;
mx=max(mx,a);
bot&=(a<=1);
}
else
bot=0;
}
if (cnt<(n+1)/2)
puts("Rejected");
else if (mx>k)
puts("Too Slow");
else if (bot)
puts("Bot");
else
puts("Accepted");
}
}