結果

問題 No.1703 Much Matching
ユーザー Manuel1024Manuel1024
提出日時 2022-12-12 23:54:28
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 801 bytes
コンパイル時間 786 ms
コンパイル使用メモリ 80,164 KB
実行使用メモリ 7,680 KB
最終ジャッジ日時 2024-11-06 21:28:52
合計ジャッジ時間 5,892 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 11 WA * 24
権限があれば一括ダウンロードができます

ソースコード

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