結果

問題 No.1703 Much Matching
ユーザー umezoumezo
提出日時 2021-10-08 23:07:19
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,404 ms / 2,000 ms
コード長 587 bytes
コンパイル時間 2,073 ms
コンパイル使用メモリ 208,676 KB
実行使用メモリ 81,156 KB
最終ジャッジ日時 2023-09-30 12:34:59
合計ジャッジ時間 11,898 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 90 ms
24,152 KB
testcase_04 AC 53 ms
17,860 KB
testcase_05 AC 179 ms
43,128 KB
testcase_06 AC 309 ms
33,524 KB
testcase_07 AC 19 ms
8,812 KB
testcase_08 AC 422 ms
56,724 KB
testcase_09 AC 417 ms
45,296 KB
testcase_10 AC 59 ms
13,916 KB
testcase_11 AC 140 ms
32,308 KB
testcase_12 AC 25 ms
8,872 KB
testcase_13 AC 151 ms
27,572 KB
testcase_14 AC 7 ms
4,920 KB
testcase_15 AC 192 ms
47,240 KB
testcase_16 AC 172 ms
20,932 KB
testcase_17 AC 215 ms
26,568 KB
testcase_18 AC 3 ms
4,380 KB
testcase_19 AC 523 ms
41,632 KB
testcase_20 AC 34 ms
7,272 KB
testcase_21 AC 643 ms
50,664 KB
testcase_22 AC 311 ms
49,764 KB
testcase_23 AC 192 ms
31,408 KB
testcase_24 AC 8 ms
4,980 KB
testcase_25 AC 57 ms
18,228 KB
testcase_26 AC 228 ms
48,020 KB
testcase_27 AC 256 ms
28,088 KB
testcase_28 AC 603 ms
66,228 KB
testcase_29 AC 156 ms
36,496 KB
testcase_30 AC 173 ms
33,180 KB
testcase_31 AC 57 ms
18,656 KB
testcase_32 AC 299 ms
43,400 KB
testcase_33 AC 277 ms
51,876 KB
testcase_34 AC 20 ms
7,780 KB
testcase_35 AC 65 ms
17,864 KB
testcase_36 AC 1,404 ms
81,156 KB
testcase_37 AC 280 ms
73,728 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define rep(i,n) for(int i=0;i<(int)(n);i++)
#define ALL(v) v.begin(),v.end()
typedef long long ll;
 
#include<bits/stdc++.h>
using namespace std;

ll dp[1010][1010];

int main(){
  ios::sync_with_stdio(false);
  std::cin.tie(nullptr);
  
  int n,m,q;
  cin>>n>>m>>q;
  vector<int> A(q),B(q);
  rep(i,q){
    cin>>A[i]>>B[i];
  }
  map<pair<int,int>,int> M;
  rep(i,q) M[{A[i],B[i]}]=1;
  
  for(int i=1;i<=n;i++){
    for(int j=1;j<=m;j++){
      if(M[{i,j}]==0) dp[i][j]=max(dp[i][j-1],dp[i-1][j]);
      else dp[i][j]=dp[i-1][j-1]+1;
    }
  }
  cout<<dp[n][m]<<endl;
  
  return 0;
}
0