結果

問題 No.1823 Tricolor Dango
ユーザー Nikita Skybytskyi
提出日時 2022-01-28 21:29:59
言語 C++17(clang)
(17.0.6 + boost 1.87.0)
結果
AC  
実行時間 46 ms / 2,000 ms
コード長 458 bytes
コンパイル時間 3,694 ms
コンパイル使用メモリ 164,208 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-12-30 05:04:00
合計ジャッジ時間 4,328 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
  cin.tie(0)->sync_with_stdio(0);

  int t; cin >> t; while (t--) {
    int n;
    cin >> n;

    vector<int> a(n);
    for (auto& ai : a) {
      cin >> ai;
    }

    sort(a.begin(), a.end());

    int64_t s = 0;
    for (auto ai : a) {
      s += ai;
    }

    if ((s % 3 != 0) ||
        (a[n - 1] > s / 3)) {
      cout << "No\n";
    } else {
      cout << "Yes\n";
    }
  }

  return 0;
}
0