結果

問題 No.1703 Much Matching
ユーザー Manuel1024Manuel1024
提出日時 2022-12-12 23:54:28
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 801 bytes
コンパイル時間 803 ms
コンパイル使用メモリ 80,724 KB
実行使用メモリ 7,936 KB
最終ジャッジ日時 2024-04-24 13:19:59
合計ジャッジ時間 5,466 ms
ジャッジサーバーID
(参考情報)
judge1 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 2 ms
6,944 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 116 ms
6,940 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 21 ms
6,944 KB
testcase_11 WA -
testcase_12 AC 7 ms
6,940 KB
testcase_13 WA -
testcase_14 AC 4 ms
6,940 KB
testcase_15 WA -
testcase_16 AC 76 ms
6,940 KB
testcase_17 WA -
testcase_18 AC 3 ms
6,940 KB
testcase_19 WA -
testcase_20 AC 23 ms
6,944 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 3 ms
6,940 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 97 ms
6,944 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 424 ms
7,936 KB
testcase_37 AC 9 ms
7,808 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

int main(){
    int n, m, q; cin >> n >> m >> q;
    vector<vector<bool>> pa(n+10, vector<bool>(m+10, false));
    for(int i = 0; i < q; i++){
        int a, b; cin >> a >> b;
        pa[a][b] = true;
    }

    vector<vector<int>> dp(n+10, vector<int>(m+10, 0));
    for(int i = 1; i <= n; i++){
        for(int j = 1; j <= m; j++){
            dp[i][j] = dp[i-1][j-1];
            if(pa[i][j]) dp[i][j]++;
            dp[i][j] = max(dp[i][j], dp[i][j-1]);
            // cerr << dp[i][j] << " ";
        }
        // cerr << endl;
    }
    int ans = 0;
    for(int i = 0; i <= n; i++){
        for(int j = 0; j <= m; j++){
            ans = max(ans, dp[i][j]);
        }
    }
    cout << ans << endl;
    return 0;
}
0