結果

問題 No.1823 Tricolor Dango
ユーザー kpinkcat
提出日時 2023-09-18 21:02:34
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 737 bytes
コンパイル時間 1,717 ms
コンパイル使用メモリ 200,728 KB
最終ジャッジ日時 2025-02-16 23:27:57
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 1 WA * 11 TLE * 1 -- * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include<iostream>
#include<map>
#include<vector>
#include <algorithm>
#include<math.h>
#include <iomanip>
#include<set>
#include <numeric>
#include<string>
using ll = long long;
using namespace std;

int main()
{
    ll t, n;
    cin >> t;
    for (int i = 0; i < t; i++){
        cin >> n;
        vector<ll> a(n);
        for (int j = 0; j < n; j++) cin >> a[j];
        while (a.size() >= 3){
            sort(a.begin(), a.end(), greater());
            a[0] -= a[2];
            a[1] -= a[2];
            a.erase(a.begin() + 2);
            if (a[1] == 0) a.erase(a.begin() + 1);
            if (a[0] == 0) a.erase(a.begin() + 0);
        }
        cout << ((a.size() == 0) ? "Yes" : "No") << endl;
    }
}
0