結果

問題 No.2509 Beam Shateki
ユーザー Today03Today03
提出日時 2023-10-20 21:44:49
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,410 bytes
コンパイル時間 2,241 ms
コンパイル使用メモリ 220,752 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 21:45:50
合計ジャッジ時間 38,271 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 144 ms
4,348 KB
testcase_04 AC 144 ms
4,348 KB
testcase_05 AC 146 ms
4,348 KB
testcase_06 AC 149 ms
4,348 KB
testcase_07 AC 149 ms
4,348 KB
testcase_08 AC 145 ms
4,348 KB
testcase_09 AC 163 ms
4,348 KB
testcase_10 AC 146 ms
4,348 KB
testcase_11 AC 142 ms
4,348 KB
testcase_12 AC 145 ms
4,348 KB
testcase_13 AC 1,391 ms
4,348 KB
testcase_14 AC 1,356 ms
4,348 KB
testcase_15 AC 1,381 ms
4,348 KB
testcase_16 AC 1,364 ms
4,348 KB
testcase_17 AC 1,328 ms
4,348 KB
testcase_18 AC 1,309 ms
4,348 KB
testcase_19 AC 1,341 ms
4,348 KB
testcase_20 AC 1,319 ms
4,348 KB
testcase_21 AC 1,368 ms
4,348 KB
testcase_22 AC 1,355 ms
4,348 KB
testcase_23 AC 1,362 ms
4,348 KB
testcase_24 AC 1,358 ms
4,348 KB
testcase_25 AC 1,377 ms
4,348 KB
testcase_26 AC 1,346 ms
4,348 KB
testcase_27 AC 1,356 ms
4,348 KB
testcase_28 AC 1,379 ms
4,348 KB
testcase_29 AC 1,329 ms
4,348 KB
testcase_30 AC 1,322 ms
4,348 KB
testcase_31 WA -
testcase_32 AC 1,298 ms
4,348 KB
testcase_33 AC 19 ms
4,348 KB
testcase_34 AC 269 ms
4,348 KB
testcase_35 AC 610 ms
4,348 KB
testcase_36 AC 103 ms
4,348 KB
testcase_37 AC 5 ms
4,348 KB
testcase_38 AC 97 ms
4,348 KB
testcase_39 AC 111 ms
4,348 KB
testcase_40 AC 332 ms
4,348 KB
testcase_41 AC 3 ms
4,348 KB
testcase_42 AC 155 ms
4,348 KB
testcase_43 AC 802 ms
4,348 KB
testcase_44 AC 913 ms
4,348 KB
testcase_45 AC 100 ms
4,348 KB
testcase_46 AC 202 ms
4,348 KB
testcase_47 AC 906 ms
4,348 KB
testcase_48 AC 232 ms
4,348 KB
testcase_49 AC 406 ms
4,348 KB
testcase_50 AC 491 ms
4,348 KB
testcase_51 AC 18 ms
4,348 KB
testcase_52 AC 326 ms
4,348 KB
testcase_53 AC 2 ms
4,348 KB
testcase_54 AC 2 ms
4,348 KB
testcase_55 AC 1 ms
4,348 KB
testcase_56 AC 1 ms
4,348 KB
testcase_57 AC 1 ms
4,348 KB
testcase_58 WA -
testcase_59 AC 2 ms
4,348 KB
testcase_60 WA -
testcase_61 AC 2 ms
4,348 KB
testcase_62 AC 2 ms
4,348 KB
testcase_63 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

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

const vector<int> dx = {0, 1, 1, 1};
const vector<int> dy = {1, 0, 1, -1};

int main() {
	int h, w;
	cin >> h >> w;
	vector<vector<int>> A(h, vector<int>(w));
	for (int i = 0; i < h; i++) {
		for (int j = 0; j < w; j++) {
			cin >> A[i][j];
		}
	}
	vector<tuple<int, int, int>> start;
	start.push_back(make_tuple(0, 0, 2));
	for (int i = 1; i <= w; i++) {
		start.push_back(make_tuple(0, i, 1));
		start.push_back(make_tuple(0, i, 2));
		start.push_back(make_tuple(0, i, 3));
	}
	start.push_back(make_tuple(0, w + 1, 3));
	for (int i = 1; i <= h; i++) {
		start.push_back(make_tuple(i, 0, 0));
		start.push_back(make_tuple(i, 0, 2));
		start.push_back(make_tuple(i, 0, 3));
	}
	long long ans = 0;
	for (tuple<int, int, int> T1 : start) {
		for (tuple<int, int, int> T2 : start) {
			long long res = 0;
			int x1, y1, d1, x2, y2, d2;
			tie(x1, y1, d1) = T1;
			tie(x2, y2, d2) = T2;
			x1 += dx[d1];
			y1 += dy[d1];
			x2 += dx[d2];
			y2 += dy[d2];
			set<pair<int, int>> st;
			while (1 <= x1 && x1 <= h && 1 <= y1 && y1 <= w) {
				res += A[x1 - 1][y1 - 1];
				st.insert(make_pair(x1, y1));
				x1 += dx[d1];
				y1 += dy[d1];
			}
			while (1 <= x2 && x2 <= h && 1 <= y2 && y2 <= w) {
				if (!st.count(make_pair(x2, y2))) {
					res += A[x2 - 1][y2 - 1];
				}
				x2 += dx[d2];
				y2 += dy[d2];
			}
			ans = max(ans, res);
		}
	}
	cout << ans << endl;
}
0