結果

問題 No.2509 Beam Shateki
ユーザー 沙耶花沙耶花
提出日時 2023-10-20 21:28:55
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 889 ms / 2,000 ms
コード長 989 bytes
コンパイル時間 4,740 ms
コンパイル使用メモリ 267,632 KB
実行使用メモリ 4,480 KB
最終ジャッジ日時 2023-10-20 21:29:42
合計ジャッジ時間 30,777 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 11 ms
4,348 KB
testcase_01 AC 11 ms
4,348 KB
testcase_02 AC 11 ms
4,348 KB
testcase_03 AC 166 ms
4,348 KB
testcase_04 AC 163 ms
4,348 KB
testcase_05 AC 155 ms
4,348 KB
testcase_06 AC 155 ms
4,348 KB
testcase_07 AC 154 ms
4,348 KB
testcase_08 AC 161 ms
4,348 KB
testcase_09 AC 159 ms
4,348 KB
testcase_10 AC 169 ms
4,348 KB
testcase_11 AC 164 ms
4,348 KB
testcase_12 AC 153 ms
4,348 KB
testcase_13 AC 889 ms
4,480 KB
testcase_14 AC 857 ms
4,480 KB
testcase_15 AC 838 ms
4,480 KB
testcase_16 AC 864 ms
4,480 KB
testcase_17 AC 857 ms
4,480 KB
testcase_18 AC 834 ms
4,480 KB
testcase_19 AC 863 ms
4,480 KB
testcase_20 AC 829 ms
4,480 KB
testcase_21 AC 867 ms
4,480 KB
testcase_22 AC 823 ms
4,480 KB
testcase_23 AC 874 ms
4,480 KB
testcase_24 AC 842 ms
4,480 KB
testcase_25 AC 831 ms
4,480 KB
testcase_26 AC 858 ms
4,480 KB
testcase_27 AC 863 ms
4,480 KB
testcase_28 AC 839 ms
4,480 KB
testcase_29 AC 861 ms
4,480 KB
testcase_30 AC 843 ms
4,480 KB
testcase_31 AC 845 ms
4,480 KB
testcase_32 AC 851 ms
4,480 KB
testcase_33 AC 47 ms
4,348 KB
testcase_34 AC 254 ms
4,348 KB
testcase_35 AC 452 ms
4,348 KB
testcase_36 AC 111 ms
4,348 KB
testcase_37 AC 15 ms
4,348 KB
testcase_38 AC 134 ms
4,348 KB
testcase_39 AC 114 ms
4,348 KB
testcase_40 AC 317 ms
4,348 KB
testcase_41 AC 16 ms
4,348 KB
testcase_42 AC 139 ms
4,348 KB
testcase_43 AC 547 ms
4,348 KB
testcase_44 AC 620 ms
4,348 KB
testcase_45 AC 122 ms
4,348 KB
testcase_46 AC 164 ms
4,348 KB
testcase_47 AC 630 ms
4,348 KB
testcase_48 AC 216 ms
4,348 KB
testcase_49 AC 330 ms
4,348 KB
testcase_50 AC 379 ms
4,348 KB
testcase_51 AC 37 ms
4,348 KB
testcase_52 AC 285 ms
4,348 KB
testcase_53 AC 12 ms
4,348 KB
testcase_54 AC 13 ms
4,348 KB
testcase_55 AC 12 ms
4,348 KB
testcase_56 AC 12 ms
4,348 KB
testcase_57 AC 12 ms
4,348 KB
testcase_58 AC 12 ms
4,348 KB
testcase_59 AC 12 ms
4,348 KB
testcase_60 AC 13 ms
4,348 KB
testcase_61 AC 12 ms
4,348 KB
testcase_62 AC 12 ms
4,348 KB
testcase_63 AC 13 ms
4,348 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <stdio.h>
#include <atcoder/all>
#include <bits/stdc++.h>
using namespace std;
using namespace atcoder;
using mint = modint998244353;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf32 1000000001
#define Inf64 4000000000000000001

int main(){
	
	int h,w;
	cin>>h>>w;
	vector a(h,vector<int>(w));
	rep(i,h){
		rep(j,w)cin>>a[i][j];
	}
	
	int ans = 0;
	vector<vector<pair<int,int>>> t;
	for(int i=-1;i<=1;i++){
		for(int j=-1;j<=1;j++){
			if(i==0&&j==0)continue;
			for(int m=-200;m<=200;m++){
				vector<pair<int,int>> c;
				rep(x,h){
					rep(y,w){
						if(i*x+y*j==m)c.emplace_back(x,y);
						
					}
				}
				t.push_back(c);
			}
			
		}
	}
	
	rep(i,t.size()){
		for(int j=i+1;j<t.size();j++){
			int sum = 0;
			rep(k,t[i].size())sum += a[t[i][k].first][t[i][k].second];
			rep(k,t[j].size()){
				if(!binary_search(t[i].begin(),t[i].end(),t[j][k]))sum += a[t[j][k].first][t[j][k].second];
			}
			ans = max(ans,sum);
			
		}
	}
	cout<<ans<<endl;
	
	return 0;
}
0