結果

問題 No.1703 Much Matching
ユーザー Drice27149Drice27149
提出日時 2021-10-08 22:42:38
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 486 bytes
コンパイル時間 416 ms
コンパイル使用メモリ 41,836 KB
実行使用メモリ 10,856 KB
最終ジャッジ日時 2023-09-30 11:44:49
合計ジャッジ時間 3,438 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,088 KB
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 57 ms
8,708 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 11 ms
7,796 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 3 ms
7,236 KB
testcase_15 WA -
testcase_16 AC 32 ms
8,492 KB
testcase_17 WA -
testcase_18 AC 3 ms
5,192 KB
testcase_19 WA -
testcase_20 AC 10 ms
7,324 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
5,204 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 237 ms
10,784 KB
testcase_37 AC 7 ms
10,856 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <algorithm>
int f[1005][1005];
int edge[1005][1005];

int main(){
	int n,m,q;
	scanf("%d%d%d",&n,&m,&q);
	for(int i = 0; i < q; i++){
		int u,v;
		scanf("%d%d",&u,&v);
		edge[u][v] = 1;
	}
	f[0][0] = 0;
	for(int i = 1; i <= n; i++){
		for(int j = 0; j <= m; j++){
			f[i][j] = 0;
			if(j){
				f[i][j] = std::max(f[i][j], f[i][j-1]);
				if(edge[i][j]){
					f[i][j] = std::max(f[i][j], f[i-1][j-1]+1);
				}
			}
		}
	}
	printf("%d\n",f[n][m]);
	return 0;
}
0