結果

問題 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,886 ms
コンパイル使用メモリ 174,716 KB
実行使用メモリ 43,384 KB
最終ジャッジ日時 2023-09-30 14:02:32
合計ジャッジ時間 10,398 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 264 ms
18,052 KB
testcase_07 AC 11 ms
4,380 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 32 ms
5,064 KB
testcase_11 WA -
testcase_12 AC 9 ms
4,376 KB
testcase_13 WA -
testcase_14 AC 4 ms
4,380 KB
testcase_15 WA -
testcase_16 AC 162 ms
12,648 KB
testcase_17 AC 232 ms
12,924 KB
testcase_18 AC 3 ms
4,376 KB
testcase_19 AC 540 ms
23,796 KB
testcase_20 AC 33 ms
5,328 KB
testcase_21 AC 710 ms
24,540 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 3 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 266 ms
13,112 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,514 ms
43,384 KB
testcase_37 AC 3 ms
4,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