結果

問題 No.1823 Tricolor Dango
ユーザー gucci0512gucci0512
提出日時 2022-05-12 16:20:10
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 67 ms / 2,000 ms
コード長 1,240 bytes
コンパイル時間 3,431 ms
コンパイル使用メモリ 226,924 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-27 15:52:49
合計ジャッジ時間 6,788 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 42 ms
4,380 KB
testcase_02 AC 43 ms
4,380 KB
testcase_03 AC 41 ms
4,380 KB
testcase_04 AC 27 ms
4,376 KB
testcase_05 AC 27 ms
4,376 KB
testcase_06 AC 27 ms
4,380 KB
testcase_07 AC 24 ms
4,376 KB
testcase_08 AC 23 ms
4,380 KB
testcase_09 AC 26 ms
4,376 KB
testcase_10 AC 25 ms
4,380 KB
testcase_11 AC 26 ms
4,376 KB
testcase_12 AC 21 ms
4,376 KB
testcase_13 AC 23 ms
4,376 KB
testcase_14 AC 26 ms
4,376 KB
testcase_15 AC 22 ms
4,376 KB
testcase_16 AC 10 ms
4,376 KB
testcase_17 AC 14 ms
4,380 KB
testcase_18 AC 25 ms
4,376 KB
testcase_19 AC 67 ms
4,376 KB
testcase_20 AC 25 ms
4,376 KB
testcase_21 AC 32 ms
4,380 KB
testcase_22 AC 40 ms
4,380 KB
testcase_23 AC 27 ms
4,380 KB
testcase_24 AC 33 ms
4,380 KB
testcase_25 AC 41 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b) for(int i=b-1;i>=0;i--)
#define rbit(i,a) for(int i=0;i<(1<<a);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x);
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
typedef long long ll;
typedef long double lld;
using namespace std;
using namespace atcoder;
using mint=static_modint<1000000007>;
const ll mod=998244353;
//const ll mod=1e9+7;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const string zton="0123456789";
const string atoz="abcdefghijklmnopqrstuvwxyz";
const ll inf=(1ll<<60);
ll gcd(ll a,ll b){
    ll r;
    r=a%b;
    if(r==0){
        return b;
    }
    else{
        return gcd(b,r);
    }
}
typedef pair<ll,int> P;

void solve(){
    int N;cin >> N;
    ll M=0;
    ll sum=0;
    rep(i,0,N){
        ll a;cin >> a;
        chmax(M,a);
        sum+=a;
    }
    if(sum%3!=0){
        cout << "No" << endl;
    }
    else if(M>(sum/3)){
        cout << "No" << endl;
    }
    else cout << "Yes" << endl;
}

int main(void){
    int t;cin >> t;
    rep(i,0,t)solve();
}
0