Codeforces 1363A - Odd Selection Solution
Solution in C++:
///******Bismillahir-Rahmanir-Rahim******///
///AH Tonmoy
///Department of CSE,23rd batch
///Islamic University,Bangladesh
- #include <bits/stdc++.h>
- using namespace std;
- int main()
- {
- int t;
- cin>>t;
- while(t--)
- {
- int n,i,c,a,e=0,o=0,in;
- cin>>n>>c;
- for( i=0; i<n; i++)
- {
- cin>>in;
- if(in%2==0)
- e++;
- else
- o++;
- }
- if(o==0||(e==0&&c%2==0)||(n==c&&o%2==0))
- cout<<"no"<<endl;
- else
- cout<<"yes"<<endl;
- }
- }
No comments