結果

問題 No.3126 Dual Query Problem
ユーザー Iroha_3856
提出日時 2025-03-10 13:39:56
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 444 ms / 2,000 ms
コード長 606 bytes
コンパイル時間 4,762 ms
コンパイル使用メモリ 286,180 KB
実行使用メモリ 22,896 KB
最終ジャッジ日時 2025-06-20 02:27:38
合計ジャッジ時間 20,657 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

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

#define rep(i, l, r) for (int i = (int)(l); i<(int)(r); i++)

int main() {
    int N, Q; cin >> N >> Q;
    set<string> st;
    vector<string> ans;
    rep(i, 0, N) {
        string x; cin >> x;
        if (st.find(x) == st.end()) {
            ans.push_back("1 "+x+" "+x);
            st.insert(x);
        }
        ans.push_back("2 "+x);
    }
    if ((int)ans.size() > Q) {
        cout << "No" << endl;
        return 0;
    }
    while((int)ans.size() < Q) ans.push_back("1 1 1");
    cout << "Yes" << endl;
    for (string s : ans) cout << s << endl;
}
0