結果

問題 No.1823 Tricolor Dango
ユーザー れいん
提出日時 2024-12-08 19:08:35
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 878 bytes
コンパイル時間 2,868 ms
コンパイル使用メモリ 249,556 KB
実行使用メモリ 6,820 KB
最終ジャッジ日時 2024-12-08 19:08:42
合計ジャッジ時間 5,987 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 9 WA * 16
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main()
{
    int T;
    cin >> T;
    for (int i = 0; i < T; i++)
    {
        int N;
        cin >> N;

        priority_queue<int> que;
        for (int j = 0; j < N; j++)
        {
            int A;
            cin >> A;
            que.push(A);
        }
        while (que.size() >= 3)
        {
            vector<int> three(3);
            for (int j = 0; j < 3; j++)
            {
                three[j] = que.top();
                que.pop();
            }
            for (int j = 0; j < 3; j++)
            {
                if (three[j] - three[2] >= 1)
                {
                    que.push(three[j] - three[2]);
                }
            }
        }
        if (que.size() == 0)
        {
            cout << "Yes\n";
        }
        else
        {
            cout << "No\n";
        }
    }
}
0