結果

問題 No.1703 Much Matching
ユーザー norikamenorikame
提出日時 2021-10-09 10:26:41
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 567 ms / 2,000 ms
コード長 799 bytes
コンパイル時間 2,434 ms
コンパイル使用メモリ 209,560 KB
実行使用メモリ 26,624 KB
最終ジャッジ日時 2024-07-26 12:27:48
合計ジャッジ時間 8,502 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 154 ms
9,600 KB
testcase_07 AC 10 ms
5,376 KB
testcase_08 AC 164 ms
9,856 KB
testcase_09 AC 191 ms
10,880 KB
testcase_10 AC 26 ms
5,376 KB
testcase_11 AC 41 ms
5,376 KB
testcase_12 AC 8 ms
5,376 KB
testcase_13 AC 75 ms
6,272 KB
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 34 ms
5,376 KB
testcase_16 AC 104 ms
7,424 KB
testcase_17 AC 122 ms
8,064 KB
testcase_18 AC 3 ms
5,376 KB
testcase_19 AC 249 ms
13,512 KB
testcase_20 AC 28 ms
5,376 KB
testcase_21 AC 291 ms
15,324 KB
testcase_22 AC 110 ms
7,808 KB
testcase_23 AC 85 ms
6,784 KB
testcase_24 AC 3 ms
5,376 KB
testcase_25 AC 11 ms
5,376 KB
testcase_26 AC 53 ms
5,632 KB
testcase_27 AC 123 ms
8,576 KB
testcase_28 AC 240 ms
13,184 KB
testcase_29 AC 46 ms
5,376 KB
testcase_30 AC 65 ms
5,888 KB
testcase_31 AC 7 ms
5,376 KB
testcase_32 AC 125 ms
8,448 KB
testcase_33 AC 85 ms
6,784 KB
testcase_34 AC 8 ms
5,376 KB
testcase_35 AC 23 ms
5,376 KB
testcase_36 AC 567 ms
26,624 KB
testcase_37 AC 2 ms
5,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