結果

問題 No.2509 Beam Shateki
ユーザー cho435cho435
提出日時 2023-10-20 23:42:24
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,128 bytes
コンパイル時間 10,183 ms
コンパイル使用メモリ 308,092 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 23:43:23
合計ジャッジ時間 53,327 ms
ジャッジサーバーID
(参考情報)
judge10 / judge9
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 195 ms
4,348 KB
testcase_04 AC 195 ms
4,348 KB
testcase_05 AC 195 ms
4,348 KB
testcase_06 AC 196 ms
4,348 KB
testcase_07 AC 197 ms
4,348 KB
testcase_08 AC 196 ms
4,348 KB
testcase_09 AC 194 ms
4,348 KB
testcase_10 AC 208 ms
4,348 KB
testcase_11 AC 193 ms
4,348 KB
testcase_12 AC 195 ms
4,348 KB
testcase_13 AC 1,710 ms
4,348 KB
testcase_14 AC 1,708 ms
4,348 KB
testcase_15 AC 1,680 ms
4,348 KB
testcase_16 AC 1,705 ms
4,348 KB
testcase_17 AC 1,676 ms
4,348 KB
testcase_18 AC 1,725 ms
4,348 KB
testcase_19 AC 1,710 ms
4,348 KB
testcase_20 AC 1,712 ms
4,348 KB
testcase_21 AC 1,736 ms
4,348 KB
testcase_22 AC 1,702 ms
4,348 KB
testcase_23 AC 1,741 ms
4,348 KB
testcase_24 AC 1,732 ms
4,348 KB
testcase_25 AC 1,712 ms
4,348 KB
testcase_26 AC 1,711 ms
4,348 KB
testcase_27 AC 1,720 ms
4,348 KB
testcase_28 AC 1,713 ms
4,348 KB
testcase_29 AC 1,741 ms
4,348 KB
testcase_30 AC 1,710 ms
4,348 KB
testcase_31 WA -
testcase_32 AC 1,737 ms
4,348 KB
testcase_33 AC 26 ms
4,348 KB
testcase_34 AC 373 ms
4,348 KB
testcase_35 AC 834 ms
4,348 KB
testcase_36 AC 152 ms
4,348 KB
testcase_37 AC 55 ms
4,348 KB
testcase_38 AC 160 ms
4,348 KB
testcase_39 AC 155 ms
4,348 KB
testcase_40 AC 474 ms
4,348 KB
testcase_41 AC 4 ms
4,348 KB
testcase_42 AC 215 ms
4,348 KB
testcase_43 AC 1,030 ms
4,348 KB
testcase_44 AC 1,235 ms
4,348 KB
testcase_45 AC 131 ms
4,348 KB
testcase_46 AC 299 ms
4,348 KB
testcase_47 AC 1,234 ms
4,348 KB
testcase_48 AC 306 ms
4,348 KB
testcase_49 AC 549 ms
4,348 KB
testcase_50 AC 648 ms
4,348 KB
testcase_51 AC 30 ms
4,348 KB
testcase_52 AC 431 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 2 ms
4,348 KB
testcase_57 AC 2 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 #

#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")

#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,0,1,1,1};
	vector<int> dy={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<int> stl;
		ll res=0;
		while(isok(x1,y1)){
			res+=a.at(x1).at(y1);
			stl.insert(x1+y1*h);
			x1+=dx.at(i);
			y1+=dy.at(i);
		}
		while(isok(x2,y2)){
			if(!stl.count(x2+y2*h)){
				res+=a.at(x2).at(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;
		for(int ch2=ch1;ch2<h+w-1;ch2++){
			int x2=0,y2=0;
			if(ch2>=h) y2=ch2-h+1;
			else x2=ch2;
			rep(i,5){
				rep(j,5){
					ans=max(ans,select(x1,y1,i,x2,y2,j));
				}
			}
		}
	}
	cout<<ans<<endl;
}
0