結果

問題 No.1823 Tricolor Dango
ユーザー srjywrdnprkt
提出日時 2023-05-24 22:56:39
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 88 ms / 2,000 ms
コード長 647 bytes
コンパイル時間 780 ms
コンパイル使用メモリ 103,984 KB
最終ジャッジ日時 2025-02-13 04:42:50
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

void solve(){

    ll N, S=0, A, mx=0;
    cin >> N;
    for (int i=0; i<N; i++){
        cin >> A;
        mx = max(mx, A);
        S += A;
    }

    if (S % 3 != 0){
        cout << "No" << endl;
        return;
    }
    
    cout << (mx <= S / 3 ? "Yes" : "No") << endl;

}

int main(){

    int T;
    cin >> T;

    while(T){
        solve();
        T--;
    }

    return 0;
}
0