結果

問題 No.1703 Much Matching
ユーザー NanashimaNanashima
提出日時 2021-10-08 23:42:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 825 bytes
コンパイル時間 1,864 ms
コンパイル使用メモリ 177,460 KB
実行使用メモリ 43,364 KB
最終ジャッジ日時 2024-07-23 08:06:00
合計ジャッジ時間 9,777 ms
ジャッジサーバーID
(参考情報)
judge1 / 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 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 266 ms
18,060 KB
testcase_07 AC 11 ms
5,376 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 34 ms
5,472 KB
testcase_11 WA -
testcase_12 AC 10 ms
5,376 KB
testcase_13 WA -
testcase_14 AC 4 ms
5,376 KB
testcase_15 WA -
testcase_16 AC 159 ms
11,652 KB
testcase_17 AC 233 ms
12,324 KB
testcase_18 AC 4 ms
5,376 KB
testcase_19 AC 532 ms
21,860 KB
testcase_20 AC 35 ms
5,676 KB
testcase_21 AC 693 ms
23,708 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 4 ms
5,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 259 ms
12,720 KB
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 1,469 ms
43,364 KB
testcase_37 AC 3 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define INF ((1LL<<62)-(1LL<<31))
#define all(a)  (a).begin(),(a).end()
#define rall(a)  (a).rbegin(),(a).rend()
typedef long long ll;
typedef pair<ll,ll> pl;

int main()
{
    ll n,m,q;
    cin >> n >> m >> q;
    vector<ll> a(q),b(q),c(q,INF);
    rep(i,q) cin >> a[i] >> b[i];
    ll ma=0;
    rep(i,q) {
        ll pos=lower_bound(all(c),a[i])-c.begin();
        c[pos]=a[i];
        ma=max(ma,pos+1);
    }
    vector<pl> p;
    rep(i,ma) rep(j,q) if(c[i]==a[j]) p.push_back({a[j],-b[j]});
    sort(all(p));
    ll ans=0;
    c.assign(q,INF);
    rep(i,(int)p.size()) {
        ll pos=lower_bound(all(c),-p[i].second)-c.begin();
        c[pos]=-p[i].second;
        ans=max(ans,pos+1);
    }
    cout << ans << endl;
    return 0;
}
0