https://codeforces.com/contest/1711/problem/C
시간 1초, 메모리 256MB
input :
output :
조건 :
#include <iostream>
#include <bits/stdc++.h>
using namespace std;
bool check(int n, int m, vector<int> data) {
long long cnt = 0, odd = 0;
for (int item : data) {
int result = item / m;
if (result >= 2)
cnt += result;
if (result >= 3)
odd = 1;
}
if (n % 2 == 0){
if (cnt >= n) return true;
else return false;
}else{
if (cnt >= n && odd) return true;
else return false;
}
}
void prologue() {
ios_base::sync_with_stdio(0);
cin.tie(nullptr);
}
int main() {
prologue();
int t;
cin >> t;
for (int i = 0; i < t; ++i) {
int n, m, k;
vector<int> data;
cin >> n >> m >> k;
for (int j = 0; j < k; ++j) {
int temp;
cin >> temp;
data.push_back(temp);
}
if (check(n, m, data) || check(m, n, data))
cout << "Yes\n";
else
cout << "No\n";
}
return 0;
}