結果

問題 No.3126 Dual Query Problem
ユーザー ケネン
提出日時 2025-04-25 21:34:01
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
OLE  
実行時間 -
コード長 709 bytes
コンパイル時間 2,468 ms
コンパイル使用メモリ 206,216 KB
実行使用メモリ 7,844 KB
最終ジャッジ日時 2025-04-25 21:34:17
合計ジャッジ時間 7,672 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 1 OLE * 1 -- * 30
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using pii = pair<int, int>;
using ll = long long;
using pll = pair<ll, ll>;

int pi = 1;
map<int, int> m;
vector<int> v;
set<int> s;

int main() {
  ios::sync_with_stdio(0);
  cin.tie(0); cout.tie(0);

  int n, q;
  cin >> n >> q;
  for (int i = 0; i < n; i++) {
    int x;
    cin >> x;
    v.push_back(x);
    s.insert(x);
  }

  if (s.size()*2 <= q) {
    cout << "Yes\n";
  } else {
    cout << "No\n";
    return 0;
  }

  for (int i = 0; i < n; i++) {
    int x = v[i];
    if (!m.count(x)) {
      cout << "1 " << pi << " " << x << "\n";
      m[x] = pi++;
      q--;
    }
    cout << "2 " << m[x] << "\n";
    q--;
  }

  while (q--) cout << "1 1 1\n";
}
0