結果

問題 No.1703 Much Matching
ユーザー eve__fuyukieve__fuyuki
提出日時 2024-04-13 13:28:52
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 154 ms / 2,000 ms
コード長 649 bytes
コンパイル時間 2,573 ms
コンパイル使用メモリ 203,808 KB
実行使用メモリ 7,552 KB
最終ジャッジ日時 2024-04-13 13:28:58
合計ジャッジ時間 6,429 ms
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,812 KB
testcase_01 AC 4 ms
6,940 KB
testcase_02 AC 2 ms
6,944 KB
testcase_03 AC 3 ms
6,940 KB
testcase_04 AC 3 ms
6,944 KB
testcase_05 AC 5 ms
6,940 KB
testcase_06 AC 70 ms
6,940 KB
testcase_07 AC 4 ms
6,940 KB
testcase_08 AC 47 ms
6,940 KB
testcase_09 AC 53 ms
6,940 KB
testcase_10 AC 9 ms
6,940 KB
testcase_11 AC 29 ms
6,940 KB
testcase_12 AC 4 ms
6,944 KB
testcase_13 AC 26 ms
6,944 KB
testcase_14 AC 2 ms
6,944 KB
testcase_15 AC 14 ms
6,944 KB
testcase_16 AC 30 ms
6,940 KB
testcase_17 AC 34 ms
6,944 KB
testcase_18 AC 2 ms
6,940 KB
testcase_19 AC 69 ms
6,940 KB
testcase_20 AC 10 ms
6,940 KB
testcase_21 AC 84 ms
6,940 KB
testcase_22 AC 34 ms
6,940 KB
testcase_23 AC 27 ms
6,940 KB
testcase_24 AC 2 ms
6,940 KB
testcase_25 AC 5 ms
6,940 KB
testcase_26 AC 20 ms
6,940 KB
testcase_27 AC 36 ms
6,944 KB
testcase_28 AC 68 ms
6,940 KB
testcase_29 AC 16 ms
6,940 KB
testcase_30 AC 22 ms
6,940 KB
testcase_31 AC 5 ms
6,940 KB
testcase_32 AC 39 ms
6,940 KB
testcase_33 AC 27 ms
6,940 KB
testcase_34 AC 4 ms
6,940 KB
testcase_35 AC 8 ms
6,940 KB
testcase_36 AC 154 ms
7,296 KB
testcase_37 AC 8 ms
7,552 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
void fast_io() {
    ios_base::sync_with_stdio(false);
    cin.tie(nullptr);
}

int main() {
    fast_io();
    int n, m, q;
    cin >> n >> m >> q;
    vector<vector<bool>> is_ok(n + 1, vector<bool>(m + 1));
    for (int i = 0; i < q; i++) {
        int a, b;
        cin >> a >> b;
        is_ok[a][b] = true;
    }
    vector<vector<int>> dp(n + 1, vector<int>(m + 1));
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= m; j++) {
            dp[i][j] = max(
                {dp[i][j - 1], dp[i - 1][j], dp[i - 1][j - 1] + is_ok[i][j]});
        }
    }
    cout << dp[n][m] << endl;
}
0