結果

問題 No.1987 Sandglass Inconvenience
ユーザー shoshoshomshoshoshom
提出日時 2022-06-24 22:17:05
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,030 bytes
コンパイル時間 2,140 ms
コンパイル使用メモリ 200,052 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-26 05:25:39
合計ジャッジ時間 3,184 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

static inline void solve() {
  long long a, b, c, x;
  cin >> a >> b >> c >> x;
  if (a > b) {
    swap(a, b);
  }
  if (a > c) {
    swap(a, c);
  }
  if (b > c) {
    swap(b, c);
  }
  set<long long> st = {0LL,
                       a,
                       b,
                       c,
                       a + b,
                       a + c,
                       b + c,
                       c - b,
                       c - a,
                       b - a,
                       max(0LL, c - b - a),
                       max(0LL, a - (c - b)),
                       max(0LL, b - (c - a)),
                       max(0LL, c - (b - a))};
  long long total = a + b + c;
  bool ok = st.count(total - x);
  cout << (ok ? "Yes" : "No") << '\n';
}

int main() {
  ios_base::sync_with_stdio(0), cin.tie(0);
#ifdef LOCAL
  int T;
  cin >> T;
  for (int tc = 1; tc <= T; tc++) {
    cout << "Case" << tc << ":" << '\n';
    solve();
  }
#else
  solve();
#endif
  return 0;
}
0