結果

問題 No.1823 Tricolor Dango
ユーザー ygd.
提出日時 2022-01-29 10:53:44
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 91 ms / 2,000 ms
コード長 923 bytes
コンパイル時間 6,129 ms
コンパイル使用メモリ 311,132 KB
最終ジャッジ日時 2025-01-27 17:44:52
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _GLIBCXX_DEBUG //遅い可能性がある 
#include <bits/stdc++.h>
#include<atcoder/all>
using namespace atcoder;
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define ALL(a) (a).begin(),(a).end() //lower_bound(ALL(a),x)
using ll = long long;
using P = pair<int,int>;
using VI = vector<int>;
using VVI = vector<vector<int>>;

int INF = 100100100;

const vector<int> dx = {1, 0, -1, 0};
const vector<int> dy = {0, 1, 0, -1};

int main() {
    int t;
    cin >> t;
    rep(i,t) {
        int n;
        cin >> n;
        VI A(n);
        rep(i,n) cin >> A[i];
        ll s = 0;
        int mx = 0;
        rep(i,n) {
            s += A[i];
            mx = max(mx, A[i]);
        }
        if (s%3 != 0) cout << "No" << endl;
        else {
            ll ns = s/3;
            if (mx <= ns) cout << "Yes" << endl;
            else cout << "No" << endl;
        }
    }
    return 0;
}


0