結果

問題 No.1823 Tricolor Dango
ユーザー mmn15277198
提出日時 2022-08-11 13:16:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 76 ms / 2,000 ms
コード長 500 bytes
コンパイル時間 1,573 ms
コンパイル使用メモリ 168,080 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-09-21 20:18:37
合計ジャッジ時間 4,499 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  while (t--) {
    int n;
    cin >> n;
    vector<int> a(n);
    long long sum = 0;
    for (int i = 0; i < n; i++) {
      cin >> a[i];
      sum += a[i];
    }
    if (sum % 3 != 0) {
      cout << "No" << endl;
      continue;
    }
    bool ok = true;
    for (int i = 0; i < n; i++) {
      if (sum / 3 < a[i]) ok = false;
    }
    if (!ok) cout << "No" << endl;
    else cout << "Yes" << endl;
  }
  return 0;
}
0