結果

問題 No.1703 Much Matching
ユーザー norikamenorikame
提出日時 2021-10-09 10:26:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 538 ms / 2,000 ms
コード長 799 bytes
コンパイル時間 2,692 ms
コンパイル使用メモリ 206,824 KB
実行使用メモリ 26,592 KB
最終ジャッジ日時 2023-10-01 05:33:46
合計ジャッジ時間 9,284 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 144 ms
9,328 KB
testcase_07 AC 9 ms
4,376 KB
testcase_08 AC 153 ms
9,700 KB
testcase_09 AC 177 ms
10,644 KB
testcase_10 AC 24 ms
4,376 KB
testcase_11 AC 38 ms
4,624 KB
testcase_12 AC 7 ms
4,380 KB
testcase_13 AC 67 ms
6,004 KB
testcase_14 AC 3 ms
4,376 KB
testcase_15 AC 31 ms
4,416 KB
testcase_16 AC 93 ms
7,272 KB
testcase_17 AC 110 ms
7,840 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 236 ms
13,448 KB
testcase_20 AC 28 ms
4,408 KB
testcase_21 AC 282 ms
15,124 KB
testcase_22 AC 106 ms
7,808 KB
testcase_23 AC 81 ms
6,520 KB
testcase_24 AC 3 ms
4,376 KB
testcase_25 AC 10 ms
4,380 KB
testcase_26 AC 52 ms
5,100 KB
testcase_27 AC 120 ms
8,284 KB
testcase_28 AC 228 ms
12,788 KB
testcase_29 AC 42 ms
4,836 KB
testcase_30 AC 62 ms
5,640 KB
testcase_31 AC 7 ms
4,376 KB
testcase_32 AC 120 ms
8,332 KB
testcase_33 AC 79 ms
6,488 KB
testcase_34 AC 8 ms
4,380 KB
testcase_35 AC 21 ms
4,376 KB
testcase_36 AC 538 ms
26,592 KB
testcase_37 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

using ll = long long;

#define rep(i, n) for (int i=0; i<(int)(n); ++(i))
#define rep3(i, m, n) for (int i=(m); (i)<(int)(n); ++(i))
#define repr(i, n) for (int i=(int)(n)-1; (i)>=0; --(i))
#define rep3r(i, m, n) for (int i=(int)(n)-1; (i)>=(int)(m); --(i))
#define all(x) (x).begin(), (x).end()

const int INF = (int)(1e9);

int main() {
	int n, m, q;
	cin >> n >> m >> q;
	vector<int> a(q), b(q);
	rep(i, q) cin >> a[i] >> b[i];
	vector<pair<int, int>> ab(q);
	rep(i, q) ab[i] = { a[i], -b[i] };
	sort(all(ab));
	vector<int> blst(q);
	rep(i, q) blst[i] = -ab[i].second;
	vector<int> dp(q+1, INF);
	rep(i, q) *lower_bound(all(dp), blst[i]) = blst[i];
	int res = 0;
	rep(i, q+1) if (dp[i] < INF) res = max(res, i+1);
	cout << res << endl;
	return 0;
}
0