結果

問題 No.2239 Friday
ユーザー 👑 hitonanodehitonanode
提出日時 2023-03-11 00:00:56
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 574 bytes
コンパイル時間 2,990 ms
コンパイル使用メモリ 244,408 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-18 09:18:43
合計ジャッジ時間 4,032 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 1 ms
4,348 KB
testcase_14 AC 2 ms
4,348 KB
testcase_15 AC 1 ms
4,348 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 AC 2 ms
4,348 KB
testcase_19 AC 2 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define FOR(i, begin, end) for(int i=(begin),i##_end_=(end);i<i##_end_;i++)
#define REP(i, n) FOR(i,0,n)
template <typename T> bool chmin(T &m, const T q) { return m > q ? (m = q, true) : false; }

int main() {
    int A, B;
    cin >> A >> B;
    int ret = 1e9;
    REP(a, A + 1) {
        int n = a;
        int m = B - (A - a);
        if (n < 0 or m < 0) continue;
        int p = A - n;
        int q = B - m;
        if (p < 0 or q < 0) continue;
        chmin(ret, abs(n + m - (p + q)));
    }
    cout << ret << endl;
}
0