結果

問題 No.1703 Much Matching
ユーザー gotetengoteten
提出日時 2021-10-08 22:52:43
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 698 bytes
コンパイル時間 1,570 ms
コンパイル使用メモリ 168,904 KB
実行使用メモリ 814,604 KB
最終ジャッジ日時 2023-09-30 12:03:48
合計ジャッジ時間 3,961 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

#define rep(i, n) for (int i = 0; i < n; i++)
#define all(x) (x).begin(),(x).end()
const int mod = 1000000007;
const long long INF = 1LL << 60;
using ll = long long;

int main()
{
  ll N,M,Q;
  cin >> N >> M >> Q;

  vector<int> a(Q+1,0),b(Q+1,0);
  rep(i,Q){
    cin >> a[i+1] >> b[i+1];
  }

  //何番目まで考えるか,最後に選んだペア
  vector<vector<int>> dp(Q+10,vector<int>(Q+10,0));

  int ans=0;
  rep(i,Q+1)if(i){
    rep(j,i+1){
      dp[i][j]=dp[i-1][j];
      rep(k,j+1)if(k<=i-1){
        if(a[j]>a[k]&&b[j]>b[k]) dp[i][j]=max(dp[i][j],dp[i-1][k]+1);
      }
      ans=max(ans,dp[i][j]);
    }
  }
  
  cout << ans << endl;
}
0