結果

問題 No.2509 Beam Shateki
ユーザー ripityripity
提出日時 2023-10-20 22:04:00
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 988 bytes
コンパイル時間 2,753 ms
コンパイル使用メモリ 222,668 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 22:04:15
合計ジャッジ時間 14,001 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 AC 76 ms
4,348 KB
testcase_04 AC 76 ms
4,348 KB
testcase_05 AC 76 ms
4,348 KB
testcase_06 AC 76 ms
4,348 KB
testcase_07 AC 75 ms
4,348 KB
testcase_08 AC 76 ms
4,348 KB
testcase_09 AC 76 ms
4,348 KB
testcase_10 AC 76 ms
4,348 KB
testcase_11 AC 77 ms
4,348 KB
testcase_12 AC 76 ms
4,348 KB
testcase_13 AC 321 ms
4,348 KB
testcase_14 AC 320 ms
4,348 KB
testcase_15 AC 320 ms
4,348 KB
testcase_16 AC 323 ms
4,348 KB
testcase_17 AC 319 ms
4,348 KB
testcase_18 AC 320 ms
4,348 KB
testcase_19 AC 321 ms
4,348 KB
testcase_20 AC 320 ms
4,348 KB
testcase_21 AC 345 ms
4,348 KB
testcase_22 AC 319 ms
4,348 KB
testcase_23 AC 320 ms
4,348 KB
testcase_24 AC 324 ms
4,348 KB
testcase_25 AC 322 ms
4,348 KB
testcase_26 AC 320 ms
4,348 KB
testcase_27 AC 319 ms
4,348 KB
testcase_28 AC 321 ms
4,348 KB
testcase_29 AC 321 ms
4,348 KB
testcase_30 AC 320 ms
4,348 KB
testcase_31 AC 320 ms
4,348 KB
testcase_32 AC 320 ms
4,348 KB
testcase_33 AC 19 ms
4,348 KB
testcase_34 AC 115 ms
4,348 KB
testcase_35 AC 195 ms
4,348 KB
testcase_36 AC 56 ms
4,348 KB
testcase_37 AC 5 ms
4,348 KB
testcase_38 AC 59 ms
4,348 KB
testcase_39 AC 53 ms
4,348 KB
testcase_40 AC 130 ms
4,348 KB
testcase_41 AC 4 ms
4,348 KB
testcase_42 AC 68 ms
4,348 KB
testcase_43 AC 225 ms
4,348 KB
testcase_44 AC 255 ms
4,348 KB
testcase_45 AC 54 ms
4,348 KB
testcase_46 AC 78 ms
4,348 KB
testcase_47 AC 256 ms
4,348 KB
testcase_48 AC 100 ms
4,348 KB
testcase_49 AC 145 ms
4,348 KB
testcase_50 AC 168 ms
4,348 KB
testcase_51 AC 17 ms
4,348 KB
testcase_52 AC 120 ms
4,348 KB
testcase_53 AC 3 ms
4,348 KB
testcase_54 AC 2 ms
4,348 KB
testcase_55 AC 2 ms
4,348 KB
testcase_56 AC 3 ms
4,348 KB
testcase_57 AC 3 ms
4,348 KB
testcase_58 AC 2 ms
4,348 KB
testcase_59 AC 2 ms
4,348 KB
testcase_60 AC 2 ms
4,348 KB
testcase_61 AC 2 ms
4,348 KB
testcase_62 WA -
testcase_63 AC 3 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main() {
	int H, W;
	cin >> H >> W;
	vector<int> x = {1, 0, 1, 1};
	vector<int> y = {0, 1, 1, -1};
	vector<map<int, long long>> s(4);
	vector<vector<long long>> A(H, vector<long long>(W));
	for( int i = 0; i < H; i++ ) {
		for( int j = 0; j < W; j++ ) {
			cin >> A[i][j];
			for( int k = 0; k < 4; k++ ) {
				s[k][x[k]*i+y[k]*j] += A[i][j];
			}
		}
	}
	long long ans = 0;
	for( int i = -2*H; i <= 3*H; i++ ) {
		for( int j = -2*W; j <= 3*W; j++ ) {
			for( int k = 0; k < 4; k++ ) {
				for( int l = 0; l < 4; l++ ) {
				  if( k == l ) continue;
					if( 0 <= i && i < H && 0 <= j && j < W ) ans = max(ans, s[k][x[k]*i+y[k]*j]+s[l][x[l]*i+y[l]*j]-A[i][j]);
					else  ans = max(ans, s[k][x[k]*i+y[k]*j]+s[l][x[l]*i+y[l]*j]);
				}
			}
		}
	}
	for( int i = 0; i < 4; i++ ) {
		vector<long long> v = {0};
		for( auto [j, k] : s[i] ) v.push_back(k);
		sort(v.rbegin(), v.rend());
		ans = max(ans, v[0]+v[1]);
	}
	cout << ans << endl;
}
0