結果

問題 No.1823 Tricolor Dango
ユーザー kpinkcatkpinkcat
提出日時 2023-09-18 21:02:34
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 737 bytes
コンパイル時間 2,148 ms
コンパイル使用メモリ 204,172 KB
実行使用メモリ 7,648 KB
最終ジャッジ日時 2023-09-18 21:02:58
合計ジャッジ時間 17,409 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,648 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 TLE -
testcase_12 WA -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
権限があれば一括ダウンロードができます

ソースコード

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