Advertisement
pb_jiang

CF1551D1

Mar 26th, 2025
371
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.41 KB | None | 0 0
  1. // Problem: D1. Domino (easy version)
  2. // Contest: Codeforces - Codeforces Round 734 (Div. 3)
  3. // URL: https://codeforces.com/problemset/problem/1551/D1
  4. // Memory Limit: 256 MB
  5. // Time Limit: 1000 ms
  6. //
  7. // Powered by CP Editor (https://cpeditor.org)
  8.  
  9. #include <assert.h>
  10. #include <bits/stdc++.h>
  11. using namespace std;
  12. #ifndef __DEBUG__
  13. #define dbg(...) 42
  14. #endif
  15. template <class T> using mpq = priority_queue<T, vector<T>, greater<T>>;
  16.  
  17. using ll = long long;
  18. using a2l = array<ll, 2>;
  19. using pll = pair<ll, ll>;
  20. using vl = vector<ll>;
  21.  
  22. void solve_wa()
  23. {
  24.     ll n, m, k;
  25.     cin >> n >> m >> k;
  26.     ll all = n * m;
  27.     if (m % 2 == 0 && n % 2 == 0) {
  28.         cout << (k % 2 == 0 ? "YES" : "NO") << '\n';
  29.         return;
  30.     }
  31.     if (n % 2) {
  32.         all -= m;
  33.         cout << (k * 2 % (2 * m) == 0 ? "YES" : "NO") << '\n';
  34.         return;
  35.     }
  36.     cout << (k * 2 % (2 * m) == m ? "YES" : "NO") << '\n';
  37. }
  38.  
  39. void solve()
  40. {
  41.     ll n, m, k;
  42.     cin >> n >> m >> k;
  43.     if (m % 2 == 0 && n % 2 == 0) {
  44.         cout << (k % 2 == 0 ? "YES" : "NO") << '\n';
  45.         return;
  46.     }
  47.  
  48.     ll all = n * m / 2;
  49.     if (n % 2) {
  50.         k -= m / 2;
  51.         all -= m / 2;
  52.     } else {
  53.         all -= n / 2;
  54.     }
  55.     cout << (all >= k && k >= 0 && k % 2 == 0 ? "YES" : "NO") << '\n';
  56. }
  57.  
  58. int main(int argc, char **argv)
  59. {
  60.     ll t;
  61.     cin >> t;
  62.     while (t--)
  63.         solve();
  64.     return 0;
  65. };
  66.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement