結果

問題 No.3126 Dual Query Problem
ユーザー t98slider
提出日時 2025-04-30 02:58:59
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 60 ms / 2,000 ms
コード長 642 bytes
コンパイル時間 1,863 ms
コンパイル使用メモリ 200,500 KB
実行使用メモリ 6,272 KB
最終ジャッジ日時 2025-06-20 02:54:44
合計ジャッジ時間 10,235 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n, q;
    cin >> n >> q;
    vector<int> x(n);
    for(auto &&v : x) cin >> v;
    auto cx = x;
    sort(cx.begin(), cx.end());
    cx.erase(unique(cx.begin(), cx.end()), cx.end());
    if(cx.size() > q - n){
        cout << "No\n";
        return 0;
    }
    cout << "Yes\n";
    for(int i = 0; i + n < q; i++) cout << 1 << ' ' << i + 1 << ' ' << (i < cx.size() ? cx[i] : 1) << '\n';
    for(int i = 0; i < n; i++){
        cout << 2 << ' ' << (int)(lower_bound(cx.begin(), cx.end(), x[i]) - cx.begin() + 1) << '\n';
    }
}
0