-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBench_Press.cpp
More file actions
48 lines (45 loc) · 924 Bytes
/
Bench_Press.cpp
File metadata and controls
48 lines (45 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#include<bits/stdc++.h>
using namespace std;
int main(){
int t;
cin>>t;
while(t--)
{
int n,w,wr;
cin>>n>>w>>wr;
int a[n];
int sum=0;
for(int i=0;i<n;i++)
{
cin>>a[i];
sum+=a[i];
}
sort(a,a+n);
int g=0;
g = sum+wr;
if((g%2)==0)
{
cout<<"YES"<<endl;
}
else{
cout<<"1";
int am = 0;
for(int i=n;i>0;i--)
{
g-=a[i];
if((g%2)==0)
{
am+=1;
break;
}
}
if(am == 1)
{
cout<<"YES"<<endl;
}
else{
cout<<"NO"<<endl;
}
}
}
}