結果

問題 No.1703 Much Matching
ユーザー SSRSSSRS
提出日時 2021-10-08 21:59:52
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 481 ms / 2,000 ms
コード長 747 bytes
コンパイル時間 1,795 ms
コンパイル使用メモリ 172,012 KB
実行使用メモリ 23,204 KB
最終ジャッジ日時 2023-09-30 10:04:54
合計ジャッジ時間 6,330 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,376 KB
testcase_04 AC 2 ms
4,376 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 129 ms
9,308 KB
testcase_07 AC 8 ms
4,376 KB
testcase_08 AC 137 ms
9,372 KB
testcase_09 AC 159 ms
10,052 KB
testcase_10 AC 22 ms
4,376 KB
testcase_11 AC 34 ms
4,920 KB
testcase_12 AC 7 ms
4,376 KB
testcase_13 AC 62 ms
5,940 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 29 ms
4,496 KB
testcase_16 AC 83 ms
7,416 KB
testcase_17 AC 99 ms
7,640 KB
testcase_18 AC 3 ms
4,384 KB
testcase_19 AC 213 ms
13,456 KB
testcase_20 AC 25 ms
4,380 KB
testcase_21 AC 253 ms
15,484 KB
testcase_22 AC 95 ms
7,812 KB
testcase_23 AC 73 ms
6,556 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 AC 10 ms
4,376 KB
testcase_26 AC 47 ms
5,332 KB
testcase_27 AC 108 ms
7,636 KB
testcase_28 AC 204 ms
11,840 KB
testcase_29 AC 38 ms
4,816 KB
testcase_30 AC 56 ms
5,688 KB
testcase_31 AC 6 ms
4,380 KB
testcase_32 AC 107 ms
7,808 KB
testcase_33 AC 72 ms
6,272 KB
testcase_34 AC 8 ms
4,380 KB
testcase_35 AC 20 ms
4,376 KB
testcase_36 AC 481 ms
23,204 KB
testcase_37 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
const int INF = 10000;
int main(){
  int N, M, Q;
  cin >> N >> M >> Q;
  vector<int> a(Q), b(Q);
  for (int i = 0; i < Q; i++){
    cin >> a[i] >> b[i];
    a[i]--;
    b[i]--;
  }
  vector<vector<int>> b2(N);
  for (int i = 0; i < Q; i++){
    b2[a[i]].push_back(b[i]);
  }
  for (int i = 0; i < N; i++){
    sort(b2[i].begin(), b2[i].end(), greater<int>());
  }
  vector<int> x;
  for (int i = 0; i < N; i++){
    int cnt = b2[i].size();
    for (int j = 0; j < cnt; j++){
      x.push_back(b2[i][j]);
    }
  }
  vector<int> dp(Q, INF);
  for (int i = 0; i < Q; i++){
    *lower_bound(dp.begin(), dp.end(), x[i]) = x[i];
  }
  cout << lower_bound(dp.begin(), dp.end(), INF) - dp.begin() << endl;
}
0