# LOCKDRAW - Editorial

Contest Div1 : Here
Contest Div2 : Here
Contest Div3 : Here

Author : Utkarsh Gupta
Tester : Takuki Kurokawa

DIFFICULTY
Cakewalk

Pre Requisites
None

Explanation :
All 3 problems have to be solved amongst between Alice and Bob, and each problem is worth at least 1 point. Assume that Alice solves more problems than Bob. The only possibilities then are that Alice solves 3 problems and Bob solves 0, or that Alice solves 2 and Bob solves 1. In the first case, Bob’s score would be 0 and Alice’s score would be at least 3, so there cannot be a draw. Therefore, we assume that Alice solves 2 problems and Bob solves 1. If Alice solves a problem worth at least as many points as Bob’s problem, then she will have more points than him (since she also solves another problem). Therefore, we can assume that Bob solves the problem worth the most points, and Alice solves both the other problems. Now, assume A \leq B \leq C. Bob solves the problem worth C points, and Alice solves the problems worth A and B points. Therefore, there can be a draw if and only if A + B = C. We can check this easily in O(1) per test case.

Time Complexity
O(T)

# SOLUTION:

Setter
#include <bits/stdc++.h>
#define int long long
using namespace std;
signed main(){
int t;
cin>>t;
while(t--){
int a, b, c, m;
cin>>a>>b>>c;
m = max(a, max(b, c));
cout<<((2*m == (a+b+c))?"YES":"NO")<<endl;
}
}

1 Like