結果

問題 No.1703 Much Matching
ユーザー bit_kyoprobit_kyopro
提出日時 2021-10-08 23:59:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 679 ms / 2,000 ms
コード長 1,484 bytes
コンパイル時間 2,137 ms
コンパイル使用メモリ 208,476 KB
実行使用メモリ 49,960 KB
最終ジャッジ日時 2023-09-30 14:30:03
合計ジャッジ時間 7,547 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 1 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 177 ms
15,556 KB
testcase_07 AC 10 ms
4,376 KB
testcase_08 AC 191 ms
16,376 KB
testcase_09 AC 221 ms
18,372 KB
testcase_10 AC 29 ms
5,216 KB
testcase_11 AC 46 ms
6,208 KB
testcase_12 AC 9 ms
4,376 KB
testcase_13 AC 85 ms
8,804 KB
testcase_14 AC 3 ms
4,380 KB
testcase_15 AC 38 ms
5,620 KB
testcase_16 AC 116 ms
11,504 KB
testcase_17 AC 139 ms
12,684 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 293 ms
23,436 KB
testcase_20 AC 33 ms
5,424 KB
testcase_21 AC 351 ms
27,132 KB
testcase_22 AC 132 ms
12,292 KB
testcase_23 AC 101 ms
9,968 KB
testcase_24 AC 3 ms
4,380 KB
testcase_25 AC 12 ms
4,376 KB
testcase_26 AC 64 ms
7,660 KB
testcase_27 AC 150 ms
13,420 KB
testcase_28 AC 284 ms
22,632 KB
testcase_29 AC 50 ms
6,560 KB
testcase_30 AC 77 ms
8,260 KB
testcase_31 AC 8 ms
4,376 KB
testcase_32 AC 149 ms
13,552 KB
testcase_33 AC 98 ms
9,920 KB
testcase_34 AC 9 ms
4,380 KB
testcase_35 AC 26 ms
4,876 KB
testcase_36 AC 679 ms
49,960 KB
testcase_37 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
/*
#include<atcoder/all>
using namespace atcoder;
using mint = modint1000000007;
*/
//g++ -I/opt/ac-library ./**.cpp
using namespace std;
using ll = long long;
using ull = unsigned long long;
const long long MOD = 1000000007;
const long double PI = 3.14159265358979;
const long long INF = 1LL<<60;
template <typename T> bool chmax(T &a, const T& b){if(a < b){a = b;return true;}return false;}
template <typename T> bool chmin(T &a, const T& b){if(a > b){a = b;return true;}return false;}
ll gcd(ll a, ll b){if (b == 0) return a;else return gcd(b, a % b);}
ll lcm(ll x,ll y){return ll(x/gcd(x,y))*y;}
template<typename T> using min_priority_queue = priority_queue<T, vector<T>, greater<T>>;
#define int long long

int32_t main() {
    int n; cin >> n;
    int m; cin >> m;
    int q; cin >> q;

    vector<pair<int,int>> AB(q), IAB(q);

    for(int i=0; i<q; i++) {
        int a, b; cin >> a >> b;
        AB[i] = {a, b};
        IAB[i] = {a, -b};
    }

    sort(AB.begin(), AB.end());
    sort(IAB.begin(), IAB.end());

    vector<int> B(q);
    int cnt = 0;
    for(int i=0; i<q; i++) {
        B[i] = -IAB[i].second;
    }

    vector<int> LIS(B.size(), INF);
    for(int i=0; i<B.size(); i++) {
        int id = lower_bound(LIS.begin(), LIS.end(), B[i]) - LIS.begin();
        LIS[id] = B[i];
    }
    int res = lower_bound(LIS.begin(), LIS.end(), INF) - LIS.begin();
    cout << res << endl;
//for(int i=0; i<m; i++) cout << LIS[i] <<" ";cout << endl;
}
0