結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 2 ms
4,348 KB
testcase_03 WA -
testcase_04 AC 2 ms
4,348 KB
testcase_05 AC 3 ms
4,348 KB
testcase_06 AC 3 ms
4,348 KB
testcase_07 AC 3 ms
4,348 KB
testcase_08 AC 3 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 3 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 WA -
testcase_14 AC 5 ms
4,348 KB
testcase_15 AC 5 ms
4,348 KB
testcase_16 AC 4 ms
4,348 KB
testcase_17 AC 5 ms
4,348 KB
testcase_18 AC 5 ms
4,348 KB
testcase_19 AC 5 ms
4,348 KB
testcase_20 AC 5 ms
4,348 KB
testcase_21 AC 4 ms
4,348 KB
testcase_22 AC 5 ms
4,348 KB
testcase_23 AC 5 ms
4,348 KB
testcase_24 AC 5 ms
4,348 KB
testcase_25 AC 5 ms
4,348 KB
testcase_26 AC 5 ms
4,348 KB
testcase_27 AC 5 ms
4,348 KB
testcase_28 AC 5 ms
4,348 KB
testcase_29 AC 5 ms
4,348 KB
testcase_30 AC 5 ms
4,348 KB
testcase_31 WA -
testcase_32 AC 5 ms
4,348 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 3 ms
4,348 KB
testcase_35 AC 4 ms
4,348 KB
testcase_36 AC 2 ms
4,348 KB
testcase_37 AC 2 ms
4,348 KB
testcase_38 AC 2 ms
4,348 KB
testcase_39 AC 2 ms
4,348 KB
testcase_40 AC 3 ms
4,348 KB
testcase_41 AC 1 ms
4,348 KB
testcase_42 AC 2 ms
4,348 KB
testcase_43 AC 4 ms
4,348 KB
testcase_44 AC 4 ms
4,348 KB
testcase_45 AC 2 ms
4,348 KB
testcase_46 AC 3 ms
4,348 KB
testcase_47 AC 4 ms
4,348 KB
testcase_48 AC 3 ms
4,348 KB
testcase_49 AC 3 ms
4,348 KB
testcase_50 AC 4 ms
4,348 KB
testcase_51 AC 2 ms
4,348 KB
testcase_52 AC 3 ms
4,348 KB
testcase_53 AC 1 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 #

#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 x,int y,int i,vector<vector<ll>> &b){
		ll res=0;
		while(isok(x,y)){
			res+=b.at(x).at(y);
			x+=dx.at(i);
			y+=dy.at(i);
		}
		return res;
	};
	auto del=[&](int x,int y,int i){
		auto ca=a;
		while(isok(x,y)){
			ca.at(x).at(y)=0;
			x+=dx.at(i);
			y+=dy.at(i);
		}
		return ca;
	};
	ll tmp=0;
	vector<tuple<int,int,int>> xyi;
	rep(ch1,h+w-1){
		int x1=0,y1=0;
		if(ch1>=h) y1=ch1-h+1;
		else x1=ch1;
		rep(i1,6){
			ll tp=select(x1,y1,i1,a);
			if(tmp<tp){
				tmp=tp;
				xyi={{x1,y1,i1}};
			}else if(tmp==tp){
				xyi.push_back({x1,y1,i1});
			}
		}
	}
	ll ans=0;
	for(auto[x1,y1,i1]:xyi){
		auto ca=del(x1,y1,i1);
		rep(ch1,h+w-1){
			int x=0,y=0;
			if(ch1>=h) y=ch1-h+1;
			else x=ch1;
			rep(i,6){
				ans=max(ans,select(x,y,i,ca));
			}
		}
	}
	cout<<ans+tmp<<endl;
}
0