結果

問題 No.2509 Beam Shateki
ユーザー binapbinap
提出日時 2023-10-20 21:55:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 1,987 ms / 2,000 ms
コード長 1,813 bytes
コンパイル時間 4,608 ms
コンパイル使用メモリ 267,336 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 21:57:03
合計ジャッジ時間 31,674 ms
ジャッジサーバーID
(参考情報)
judge12 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 227 ms
4,348 KB
testcase_04 AC 227 ms
4,348 KB
testcase_05 AC 227 ms
4,348 KB
testcase_06 AC 227 ms
4,348 KB
testcase_07 AC 239 ms
4,348 KB
testcase_08 AC 228 ms
4,348 KB
testcase_09 AC 227 ms
4,348 KB
testcase_10 AC 226 ms
4,348 KB
testcase_11 AC 228 ms
4,348 KB
testcase_12 AC 228 ms
4,348 KB
testcase_13 AC 1,948 ms
4,348 KB
testcase_14 AC 1,948 ms
4,348 KB
testcase_15 AC 1,948 ms
4,348 KB
testcase_16 AC 1,944 ms
4,348 KB
testcase_17 AC 1,945 ms
4,348 KB
testcase_18 AC 1,945 ms
4,348 KB
testcase_19 AC 1,944 ms
4,348 KB
testcase_20 AC 1,973 ms
4,348 KB
testcase_21 AC 1,972 ms
4,348 KB
testcase_22 AC 1,948 ms
4,348 KB
testcase_23 AC 1,987 ms
4,348 KB
testcase_24 AC 1,983 ms
4,348 KB
testcase_25 AC 1,944 ms
4,348 KB
testcase_26 AC 1,943 ms
4,348 KB
testcase_27 AC 1,950 ms
4,348 KB
testcase_28 AC 1,951 ms
4,348 KB
testcase_29 AC 1,972 ms
4,348 KB
testcase_30 AC 1,950 ms
4,348 KB
testcase_31 AC 1,960 ms
4,348 KB
testcase_32 AC 1,945 ms
4,348 KB
testcase_33 AC 42 ms
4,348 KB
testcase_34 AC 434 ms
4,348 KB
testcase_35 AC 939 ms
4,348 KB
testcase_36 AC 155 ms
4,348 KB
testcase_37 AC 9 ms
4,348 KB
testcase_38 AC 185 ms
4,348 KB
testcase_39 AC 149 ms
4,348 KB
testcase_40 AC 608 ms
4,348 KB
testcase_41 AC 4 ms
4,348 KB
testcase_42 AC 215 ms
4,348 KB
testcase_43 AC 1,262 ms
4,348 KB
testcase_44 AC 1,421 ms
4,348 KB
testcase_45 AC 141 ms
4,348 KB
testcase_46 AC 259 ms
4,348 KB
testcase_47 AC 1,403 ms
4,348 KB
testcase_48 AC 355 ms
4,348 KB
testcase_49 AC 684 ms
4,348 KB
testcase_50 AC 756 ms
4,348 KB
testcase_51 AC 29 ms
4,348 KB
testcase_52 AC 459 ms
4,348 KB
testcase_53 AC 2 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 2 ms
4,348 KB
testcase_58 AC 2 ms
4,348 KB
testcase_59 AC 3 ms
4,348 KB
testcase_60 AC 3 ms
4,348 KB
testcase_61 AC 3 ms
4,348 KB
testcase_62 AC 3 ms
4,348 KB
testcase_63 AC 3 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
#include<atcoder/all>
#define rep(i,n) for(int i=0;i<n;i++)
using namespace std;
using namespace atcoder;
typedef long long ll;
typedef vector<int> vi;
typedef vector<long long> vl;
typedef vector<vector<int>> vvi;
typedef vector<vector<long long>> vvl;
typedef long double ld;

template <int m>
std::ostream& operator<<(std::ostream& os, const atcoder::static_modint<m>& a) {os << a.val(); return os;}
template<typename T>
istream& operator>>(istream& is, vector<T>& v){int n = v.size(); assert(n > 0); rep(i, n) is >> v[i]; return is;}
template<typename T>
ostream& operator<<(ostream& os, const vector<T>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : " "); return os;}
template <typename T>
ostream& operator<<(ostream& os, const vector<vector<T>>& v){int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "\n" : ""); return os;}

int main(){
	int h, w;
	cin >> h >> w;
	vector<vector<int>> a(h, vi(w));
	rep(y, h) cin >> a[y];
	int ans = 0;
	int n = h + w + (h + w - 1) + (h + w - 1);
	vi v(2);
	for(v[0] = 0; v[0] < n; v[0]++){
		for(v[1] = v[0] + 1; v[1] < n; v[1]++){
			unordered_set<int> se;
			rep(i, 2){
				if(v[i] < h){
					int y = v[i];
					rep(x, w) se.insert(y * w + x);
				}else if(v[i] < h + w){
					int x = v[i] - h;
					rep(y, h) se.insert(y * w + x);
				}else if(v[i] < h + w + (h + w - 1)){
					int s = v[i] - (h + w);
					rep(y, h){
						int x = s - y;
						if(x >= 0 and x < w) se.insert(y * w + x);
					}
				}else{
					int d = v[i] - (h + w + (h + w - 1)) - (w - 1);
					rep(y, h){
						int x = y - d;
						if(x >= 0 and x < w) se.insert(y * w + x);
					}
				}
			}
			int tmp = 0;
			for(auto z : se){
				int y = z / w;
				int x = z % w;
				tmp += a[y][x];
			}
			ans = max(ans, tmp);
		}
	}
	cout << ans;
	return 0;
}
0