結果

問題 No.3126 Dual Query Problem
ユーザー ldsyb
提出日時 2025-04-25 21:54:21
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,217 bytes
コンパイル時間 5,989 ms
コンパイル使用メモリ 333,860 KB
実行使用メモリ 9,472 KB
最終ジャッジ日時 2025-04-25 21:54:49
合計ジャッジ時間 13,101 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 20 WA * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using namespace chrono;
#if __has_include(<atcoder/all>)
#include <atcoder/all>
using namespace atcoder;
#endif

int main()
{
    int64_t n, q;
    cin >> n >> q;
    vector<int64_t> xs(n);
    for (auto &&x : xs)
    {
        cin >> x;
    }

    vector<int64_t> ops(q), ps(q), ts(q);

    int64_t a = 0;

    {
        int64_t j = 0;
        for (int64_t i = 0; i < q; i++)
        {
            if (j < n && a != xs[j])
            {
                ops[i] = 1;
                ps[i] = 1;
                ts[i] = xs[j];

                a = xs[j];
            }
            else if (j < n)
            {
                ops[i] = 2;
                ps[i] = 1;
                j++;
            }
            else
            {
                ops[i] = 1;
                ps[i] = 1;
                ts[i] = 1;
            }
        }

        if (j < n)
        {
            cout << "No" << endl;
            return 0;
        }
    }

    cout << "Yes" << endl;
    for (int64_t i = 0; i < q; i++)
    {
        cout << ops[i] << ' ' << ps[i] << ' ';
        if (ops[i] == 1)
        {
            cout << ts[i];
        }
        cout << endl;
    }

    return 0;
}
0