結果

問題 No.1703 Much Matching
ユーザー bit_kyoprobit_kyopro
提出日時 2021-10-08 23:59:58
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 704 ms / 2,000 ms
コード長 1,484 bytes
コンパイル時間 2,164 ms
コンパイル使用メモリ 211,084 KB
実行使用メモリ 50,212 KB
最終ジャッジ日時 2024-07-23 08:32:17
合計ジャッジ時間 7,456 ms
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 2 ms
6,940 KB
testcase_04 AC 2 ms
6,940 KB
testcase_05 AC 2 ms
6,940 KB
testcase_06 AC 183 ms
15,824 KB
testcase_07 AC 11 ms
6,940 KB
testcase_08 AC 198 ms
16,520 KB
testcase_09 AC 230 ms
18,608 KB
testcase_10 AC 30 ms
6,944 KB
testcase_11 AC 48 ms
6,940 KB
testcase_12 AC 10 ms
6,944 KB
testcase_13 AC 88 ms
9,088 KB
testcase_14 AC 4 ms
6,940 KB
testcase_15 AC 41 ms
6,940 KB
testcase_16 AC 120 ms
11,544 KB
testcase_17 AC 144 ms
12,928 KB
testcase_18 AC 4 ms
6,940 KB
testcase_19 AC 305 ms
23,728 KB
testcase_20 AC 36 ms
6,944 KB
testcase_21 AC 366 ms
27,452 KB
testcase_22 AC 136 ms
12,372 KB
testcase_23 AC 105 ms
10,112 KB
testcase_24 AC 3 ms
6,940 KB
testcase_25 AC 13 ms
6,944 KB
testcase_26 AC 67 ms
7,680 KB
testcase_27 AC 159 ms
13,640 KB
testcase_28 AC 293 ms
22,740 KB
testcase_29 AC 53 ms
6,944 KB
testcase_30 AC 80 ms
8,576 KB
testcase_31 AC 8 ms
6,944 KB
testcase_32 AC 153 ms
13,684 KB
testcase_33 AC 102 ms
10,112 KB
testcase_34 AC 10 ms
6,944 KB
testcase_35 AC 27 ms
6,940 KB
testcase_36 AC 704 ms
50,212 KB
testcase_37 AC 3 ms
6,940 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