結果

問題 No.572 妖精の演奏
ユーザー takiteketakiteke
提出日時 2017-10-06 23:49:05
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 813 bytes
コンパイル時間 589 ms
コンパイル使用メモリ 75,392 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-28 11:03:59
合計ジャッジ時間 1,778 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 1 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 WA -
testcase_11 RE -
testcase_12 RE -
testcase_13 RE -
testcase_14 AC 3 ms
5,376 KB
testcase_15 AC 2 ms
5,376 KB
testcase_16 AC 3 ms
5,376 KB
testcase_17 AC 3 ms
5,376 KB
testcase_18 AC 2 ms
5,376 KB
testcase_19 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<string>
#include<algorithm>
#include<cmath>
#include<queue>
#include<vector>
#include<stack>
using namespace std;

#define int long long
#define REP(i,n) for(int i=0;(i)<(n);(i)++)
#define ll long long

int dp[30][1000];
int n, m;
int A[40][40];

void makedp() {
	for (int i = 1;i < 1000;i++) {
		for (int j = 0;j < m;j++) {
			int tmp = 0;
			for (int k = 0;k < m;k++) {
				tmp = max(tmp, dp[k][i - 1] + A[k][j]);
			}
			dp[j][i] = tmp;
		}
	}

	/*
	REP(i,n+1){
		REP(j, m) {
			cout << dp[j][i] << " ";
		}
		cout << endl;
	}
	*/
}

signed main() {
	cin >> n >> m;
	REP(i, m) {
		REP(j, m) cin >> A[i][j];//0-indexed
	}

	makedp();

	int ans = 0;
	REP(i, m) ans = max(ans, dp[i][n-1]);

	cout << ans;

	return 0;
}
0