結果

問題 No.1703 Much Matching
ユーザー abc3abc3
提出日時 2021-10-08 23:31:38
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,272 bytes
コンパイル時間 1,944 ms
コンパイル使用メモリ 202,456 KB
実行使用メモリ 11,180 KB
最終ジャッジ日時 2023-09-30 13:41:42
合計ジャッジ時間 52,393 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 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 TLE -
testcase_07 RE -
testcase_08 RE -
testcase_09 TLE -
testcase_10 RE -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 WA -
testcase_15 RE -
testcase_16 RE -
testcase_17 RE -
testcase_18 WA -
testcase_19 TLE -
testcase_20 RE -
testcase_21 TLE -
testcase_22 RE -
testcase_23 RE -
testcase_24 WA -
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 TLE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 WA -
testcase_35 RE -
testcase_36 TLE -
testcase_37 AC 2 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

    #include <bits/stdc++.h>
    using namespace std;
    #include <math.h>
    #include <iomanip>
    #include <cstdint>
    #include <string>
    #include <sstream>
    template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return 1; } return 0; }
    template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return 1; } return 0; }
    #define rep(i,n) for (int i = 0; i < (n); ++i)
    typedef long long ll;
    typedef long double ld;
    typedef unsigned long long ull;
    using P=pair<int,int>;
    const int INF=1001001001;
    const int mod=1e9+7;

    void solve(){
        int n,m,q;
        cin>>n>>m>>q;
        vector<P>p(q+1);
        for(int i=1;i<=q;i++)cin>>p[i].first>>p[i].second;
        vector<int>dp(n+1,-INF);
        dp[0]=0;
        for(int i=1;i<=q;i++){
            for(int j=i-1;j>=0;j--){
                if(dp[j] != -INF && p[j].second < p[i].second && p[j].first < p[i].first){
                    chmax(dp[i],dp[j]+1);
                }
            }
        }
        int ans=0;
        rep(i,q+1){
            chmax(ans,dp[i]);
        }
        cout<<ans<<endl;
    } 
    int main(){
        ios_base::sync_with_stdio(false);
        cin.tie(NULL);
        
        solve(); 
        
        return 0;
    }
0