Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Problem: D1. Domino (easy version)
- // Contest: Codeforces - Codeforces Round 734 (Div. 3)
- // URL: https://codeforces.com/problemset/problem/1551/D1
- // Memory Limit: 256 MB
- // Time Limit: 1000 ms
- //
- // Powered by CP Editor (https://cpeditor.org)
- #include <assert.h>
- #include <bits/stdc++.h>
- using namespace std;
- #ifndef __DEBUG__
- #define dbg(...) 42
- #endif
- template <class T> using mpq = priority_queue<T, vector<T>, greater<T>>;
- using ll = long long;
- using a2l = array<ll, 2>;
- using pll = pair<ll, ll>;
- using vl = vector<ll>;
- void solve_wa()
- {
- ll n, m, k;
- cin >> n >> m >> k;
- ll all = n * m;
- if (m % 2 == 0 && n % 2 == 0) {
- cout << (k % 2 == 0 ? "YES" : "NO") << '\n';
- return;
- }
- if (n % 2) {
- all -= m;
- cout << (k * 2 % (2 * m) == 0 ? "YES" : "NO") << '\n';
- return;
- }
- cout << (k * 2 % (2 * m) == m ? "YES" : "NO") << '\n';
- }
- void solve()
- {
- ll n, m, k;
- cin >> n >> m >> k;
- if (m % 2 == 0 && n % 2 == 0) {
- cout << (k % 2 == 0 ? "YES" : "NO") << '\n';
- return;
- }
- ll all = n * m / 2;
- if (n % 2) {
- k -= m / 2;
- all -= m / 2;
- } else {
- all -= n / 2;
- }
- cout << (all >= k && k >= 0 && k % 2 == 0 ? "YES" : "NO") << '\n';
- }
- int main(int argc, char **argv)
- {
- ll t;
- cin >> t;
- while (t--)
- solve();
- return 0;
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement