結果
| 問題 |
No.1213 sio
|
| コンテスト | |
| ユーザー |
risujiroh
|
| 提出日時 | 2020-08-30 16:58:16 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 838 bytes |
| コンパイル時間 | 4,342 ms |
| コンパイル使用メモリ | 245,848 KB |
| 最終ジャッジ日時 | 2025-01-14 00:20:46 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 25 |
ソースコード
#include <bits/extc++.h>
#ifndef DUMP
#define DUMP(...) void(0)
#endif
using namespace std;
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int64_t n, m;
cin >> n >> m;
if (n % 2 == 0 and m % 2 == 0) {
cout << "0\n";
exit(0);
}
if (n % 2) swap(n, m);
if (n % 2 == 0) {
cout << n / 4 << '\n';
exit(0);
}
assert(n % 2 and m % 2);
if (n % 4 == 1 and m % 4 == 1) {
cout << n / 4 + m / 4 << '\n';
exit(0);
}
if (n % 4 == 3) swap(n, m);
if (n % 4 == 1) {
assert(m % 4 == 3);
cout << n / 4 + m / 4 << '\n';
exit(0);
}
assert(n % 4 == 3 and m % 4 == 3);
if (n > m) swap(n, m);
assert(n <= m);
if (n == 3) {
cout << m / 4 << '\n';
} else {
assert(n >= 7);
cout << (n - 7) / 4 + (m - 7) / 4 + 4 << '\n';
}
}
risujiroh