結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,044 KB
testcase_01 AC 2 ms
5,040 KB
testcase_02 AC 1 ms
5,036 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 53 ms
8,972 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 AC 12 ms
9,144 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 4 ms
8,880 KB
testcase_15 WA -
testcase_16 AC 36 ms
9,072 KB
testcase_17 WA -
testcase_18 AC 3 ms
5,680 KB
testcase_19 WA -
testcase_20 AC 12 ms
9,100 KB
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 4 ms
7,072 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 193 ms
10,884 KB
testcase_37 AC 7 ms
10,788 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] = edge[v][u] = 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