# RCBPLAY - Editorial

Setter: Utkarsh Gupta
Tester: Manan Grover
Editorialist: Ajit Sharma Kasturi

CAKEWALK

None

## PROBLEM:

In this year’s IPL, team RCB currently has X points and needs atleast Y points to qualify for playoffs. They still have Z matches left to play. We need to determine if there is a possibility for RCB to qualify for playoffs this year. A win gives 2 points and a draw gives 1 point for a team.

## EXPLANATION:

• The maximum points RCB could win is X+2\cdot Z. ( The case where they win every match of their remaining Z matches ) .

• In order for RCB to qualify for playoffs, this maximum value must be atleast Y.

• Therefore, if X+2 \cdot Z \geq Y, we output YES, else we output NO.

## TIME COMPLEXITY:

O(1) for each testcase.

## SOLUTION:

Editorialist's solution

#include <bits/stdc++.h>
using namespace std;

int main()
{
int tests;
cin >> tests;
while (tests--)
{
int x, y, z;
cin >> x >> y >> z;
if (x + 2 * z >= y)
cout << "YES" << endl;
else
cout << "NO" << endl;
}
}


Setter's solution

#include <bits/stdc++.h>
using namespace std;

int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);

int t;
cin >> t;
assert(1 <= t && t <= 5000);
while(t--){
int x, y, z;
cin >> x >> y >> z;
assert(0 <= x && x <= 1000);
assert(0 <= y && y <= 1000);
assert(0 <= z && z <= 1000);
bool flg = false;
for(int w = 0; w <= z; w++){
for(int d = 0; d + w <= z; d++){
if(x + w + w + d >= y){
flg = true;
break;
}
}
if(flg)break;
}
if(flg)cout << "YES" << '\n';
else cout << "NO" << '\n';
}

return 0;
}


Tester's solution
#include <bits/stdc++.h>
using namespace std;
int main(){
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
int t;
cin>>t;
while(t--){
int x, y, z;
cin>>x>>y>>z;
if(x + 2 * z >= y){
cout<<"YES\n";
}else{
cout<<"NO\n";
}
}
return 0;
}



Please comment below if you have any questions, alternate solutions, or suggestions.

#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, x, y, z, q;
cin >> n;
for (int i = 0; i < n; i++)
{
cin >> x >> y >> z;
q = y - x;
for (int i = 0; i < z; i++)
{
q=q+2;
}
if (q >=y)
{
cout << “YES\n”;
}
else
{
cout << “NO\n”;
}
}
return 0;
}
Is this way correct?