結果

問題 No.1703 Much Matching
ユーザー NanashimaNanashima
提出日時 2021-10-09 16:28:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 377 ms / 2,000 ms
コード長 693 bytes
コンパイル時間 3,819 ms
コンパイル使用メモリ 172,988 KB
実行使用メモリ 7,560 KB
最終ジャッジ日時 2023-10-11 02:49:16
合計ジャッジ時間 8,198 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,372 KB
testcase_01 AC 1 ms
4,372 KB
testcase_02 AC 2 ms
4,372 KB
testcase_03 AC 3 ms
4,492 KB
testcase_04 AC 3 ms
4,376 KB
testcase_05 AC 4 ms
5,628 KB
testcase_06 AC 104 ms
4,932 KB
testcase_07 AC 7 ms
4,372 KB
testcase_08 AC 114 ms
6,680 KB
testcase_09 AC 127 ms
5,588 KB
testcase_10 AC 19 ms
4,372 KB
testcase_11 AC 30 ms
4,924 KB
testcase_12 AC 7 ms
4,368 KB
testcase_13 AC 51 ms
4,620 KB
testcase_14 AC 4 ms
4,372 KB
testcase_15 AC 26 ms
5,812 KB
testcase_16 AC 67 ms
4,376 KB
testcase_17 AC 79 ms
4,560 KB
testcase_18 AC 2 ms
4,372 KB
testcase_19 AC 165 ms
5,292 KB
testcase_20 AC 20 ms
4,372 KB
testcase_21 AC 196 ms
5,812 KB
testcase_22 AC 80 ms
6,032 KB
testcase_23 AC 59 ms
4,992 KB
testcase_24 AC 2 ms
4,368 KB
testcase_25 AC 9 ms
4,372 KB
testcase_26 AC 42 ms
5,928 KB
testcase_27 AC 85 ms
4,508 KB
testcase_28 AC 164 ms
6,816 KB
testcase_29 AC 32 ms
5,436 KB
testcase_30 AC 47 ms
4,980 KB
testcase_31 AC 6 ms
4,368 KB
testcase_32 AC 89 ms
5,804 KB
testcase_33 AC 60 ms
6,088 KB
testcase_34 AC 7 ms
4,368 KB
testcase_35 AC 17 ms
4,368 KB
testcase_36 AC 377 ms
7,452 KB
testcase_37 AC 8 ms
7,560 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0; i<(n); i++)
#define INF ((1LL<<62)-(1LL<<31))
#define all(a)  (a).begin(),(a).end()
#define rall(a)  (a).rbegin(),(a).rend()
typedef long long ll;
typedef pair<ll,ll> pl;

int main() {
    int n,m,q;
    cin >> n >> m >> q;
    vector<vector<bool>> flag(n,vector<bool> (m,false));
    rep(i,q) {
        int a,b;
        cin >> a >> b;
        a--; b--;
        flag[a][b]=true;
    }  
    vector<vector<int>> dp(n+1,vector<int> (m+1,0));
    rep(i,n) rep(j,m) {
        if(flag[i][j]) dp[i+1][j+1]=dp[i][j]+1;
        else dp[i+1][j+1]=max(dp[i+1][j],dp[i][j+1]);
    }
    cout << dp[n][m] << endl;
    return 0;
}
0