結果
| 問題 |
No.2509 Beam Shateki
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2023-10-20 23:20:03 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 979 bytes |
| コンパイル時間 | 3,579 ms |
| コンパイル使用メモリ | 253,340 KB |
| 最終ジャッジ日時 | 2025-02-17 11:04:19 |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 55 WA * 6 |
ソースコード
#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){
ll res=0;
while(isok(x,y)){
res+=a.at(x).at(y);
x+=dx.at(i);
y+=dy.at(i);
}
return res;
};
auto del=[&](int x,int y,int i){
while(isok(x,y)){
a.at(x).at(y)=0;
x+=dx.at(i);
y+=dy.at(i);
}
};
ll sm=0;
rep(lp,2){
ll ans=0;
int x=0,y=0,i=0;
rep(ch1,h+w-1){
int x1=0,y1=0;
if(ch1>=h) y1=ch1-h+1;
else x1=ch1;
rep(i1,6){
ll tmp=select(x1,y1,i1);
if(ans<tmp){
ans=tmp;
x=x1;
y=y1;
i=i1;
}
}
}
del(x,y,i);
sm+=ans;
}
cout<<sm<<endl;
}