結果

問題 No.1703 Much Matching
ユーザー srjywrdnprktsrjywrdnprkt
提出日時 2023-06-03 16:05:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 743 bytes
コンパイル時間 1,216 ms
コンパイル使用メモリ 117,360 KB
実行使用メモリ 54,384 KB
最終ジャッジ日時 2023-08-28 07:58:41
合計ジャッジ時間 15,281 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 5 ms
4,704 KB
testcase_04 AC 5 ms
4,380 KB
testcase_05 AC 9 ms
5,524 KB
testcase_06 WA -
testcase_07 RE -
testcase_08 WA -
testcase_09 RE -
testcase_10 WA -
testcase_11 RE -
testcase_12 WA -
testcase_13 RE -
testcase_14 WA -
testcase_15 RE -
testcase_16 WA -
testcase_17 RE -
testcase_18 WA -
testcase_19 RE -
testcase_20 WA -
testcase_21 RE -
testcase_22 WA -
testcase_23 RE -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 WA -
testcase_31 RE -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 RE -
testcase_36 AC 1,626 ms
54,384 KB
testcase_37 AC 19 ms
7,488 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <iostream>
#include <vector>
#include <cmath>
#include <map>
#include <set>
#include <iomanip>
#include <queue>
#include <algorithm>
#include <numeric>
#include <deque>
#include <complex>
#include <cassert>

using namespace std;
using ll = long long;

int main(){

    int N, M, Q, a, b;
    cin >> N >> M >> Q;
    set<pair<int, int>> st;
    for (int i=0; i<Q; i++){
        cin >> a >> b;
        st.insert({a, b});
    }

    vector<vector<int>> dp(N+1, vector<int>(M+1));

    for (int i=1; i<=N; i++){
        for (int j=1; j<=N; j++){
            dp[i][j] = max(dp[i-1][j], dp[i][j-1]);
            if (st.count({i, j})) dp[i][j] = max(dp[i][j], dp[i-1][j-1]+1);
        }
    }

    cout << dp[N][M] << endl;

    return 0;
}
0