結果

問題 No.2509 Beam Shateki
ユーザー cho435cho435
提出日時 2023-10-20 22:51:35
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,091 bytes
コンパイル時間 4,819 ms
コンパイル使用メモリ 271,172 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 22:51:59
合計ジャッジ時間 23,673 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 1,482 ms
4,348 KB
testcase_04 AC 1,481 ms
4,348 KB
testcase_05 AC 1,461 ms
4,348 KB
testcase_06 AC 1,459 ms
4,348 KB
testcase_07 AC 1,499 ms
4,348 KB
testcase_08 AC 1,488 ms
4,348 KB
testcase_09 AC 1,475 ms
4,348 KB
testcase_10 AC 1,484 ms
4,348 KB
testcase_11 AC 1,483 ms
4,348 KB
testcase_12 AC 1,483 ms
4,348 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
testcase_61 -- -
testcase_62 -- -
testcase_63 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
using ll = long long;
#define rep(i,n) for(int i=0;i<(int)(n);i++)
using mint = atcoder::modint1000000007;

int main(){
	int h,w;
	cin>>h>>w;
	vector<vector<ll>> a(h,vector<ll>(w));
	rep(i,h) rep(j,w) cin>>a.at(i).at(j);
	vector<int> dx={-1,-1,0,1,1,1};
	vector<int> dy={0,1,1,1,0,-1};
	auto isok=[&](int x,int y){
		return 0<=x&&x<h&&0<=y&&y<w;
	};
	auto select=[&](int x1,int y1,int i,int x2,int y2,int j){
		set<pair<int,int>> stl;
		ll res=0;
		while(isok(x1,y1)){
			if(!stl.count({x1,y1})){
				res+=a.at(x1).at(y1);
			}
			stl.insert({x1,y1});
			x1+=dx.at(i);
			y1+=dy.at(i);
		}
		while(isok(x2,y2)){
			if(!stl.count({x2,y2})){
				res+=a.at(x2).at(y2);
			}
			stl.insert({x2,y2});
			x2+=dx.at(j);
			y2+=dy.at(j);
		}
		return res;
	};
	ll ans=0;
	rep(ch1,h+w-1){
		int x1=0,y1=0;
		if(ch1>=h) y1=ch1-h+1;
		else x1=ch1;
		rep(ch2,h+w-1){
			int x2=0,y2=0;
			if(ch2>=h) y2=ch2-h+1;
			else x2=ch2;
			rep(i,6){
				rep(j,6){
					ans=max(ans,select(x1,y1,i,x2,y2,j));
				}
			}
		}
	}
	cout<<ans<<endl;
}
0