結果

問題 No.1823 Tricolor Dango
コンテスト
ユーザー Nalime
提出日時 2026-07-03 22:26:48
言語 C++23(gnu拡張)
(gcc 15.2.0 + boost 1.90.0)
コンパイル:
g++-15 -O2 -lm -std=gnu++23 -Wuninitialized -DONLINE_JUDGE -o a.out _filename_
実行:
./a.out
結果
AC  
実行時間 11 ms / 2,000 ms
コード長 1,042 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,682 ms
コンパイル使用メモリ 359,952 KB
実行使用メモリ 6,528 KB
最終ジャッジ日時 2026-07-03 22:27:01
合計ジャッジ時間 6,134 ms
ジャッジサーバーID
(参考情報)
judge2_0 / judge3_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 25
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

#include <bits/stdc++.h>

using namespace std;

using ll = long long;
using i128 = __int128_t;
using uint = unsigned;
using ull = unsigned long long;
using u128 = __uint128_t;
using pii = pair<int, int>;

int sz(auto&& x) { return int(size(x)); }

const auto& range = views::iota;

template <typename CharT, class Traits>
auto& operator<<(basic_ostream<CharT, Traits>& os,
        ranges::forward_range auto&& v) {
    if (empty(v)) return os;
    auto it = begin(v);
    os << *it++;
    while (it != end(v)) os << ' ' << *it++;
    return os;
}

// End template

bool solve() {
    int n;
    cin >> n;

    int mx = 0;
    ll sum = 0;
    while (n--) {
        int x;
        cin >> x;

        mx = max(mx, x);
        sum += x;
    }

    return sum % 3 == 0 && 3LL * mx <= sum;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int tcs = 1;
    cin >> tcs;
    for (int tc = 1; tc <= tcs; ++tc) {
        if (solve()) {
            println("Yes");
        } else {
            println("No");
        }
    }
}
0