結果
| 問題 |
No.2648 [Cherry 6th Tune D] 一次元の馬
|
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2025-11-20 17:27:50 |
| 言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,652 bytes |
| コンパイル時間 | 2,866 ms |
| コンパイル使用メモリ | 282,176 KB |
| 実行使用メモリ | 13,568 KB |
| 最終ジャッジ日時 | 2025-11-20 17:27:57 |
| 合計ジャッジ時間 | 6,186 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 1 WA * 37 |
ソースコード
#ifdef ONPC
#define _GLIBCXX_DEBUG
#endif
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef vector<vector<int>> vvi;
typedef vector<pair<int,int>> vpi;
typedef pair<int,int> pi;
#define F first
#define S second
#define PB push_back
#define MP make_pair
#define popcount __builtin_popcountll
#define forn(i,a,b) for (int i = a; i < b; i++)
void solve(){
int n,m;cin>>n>>m;
vvi grid(n,vi(m));
forn(i,0,n){
forn(j,0,m){
cin>>grid[i][j];
}
}
int x=0;
forn(i,0,n-1){
forn(j,0,m-1){
if(grid[i][j]==1&&grid[i][j+1]&&grid[i+1][j+1])x=1;
}
}
if(x==0){
cout<<0;
return;
}
vvi down(n,vi(m));
for(int i=n-1;i>=0;i--){
forn(j,0,m){
if(grid[i][j]==1){
down[i][j]=1;
if(i!=n-1){
down[i][j]+=down[i+1][j];
}
}
}
}
int ans=0;
forn(i,0,n){
forn(j,0,m){
if(grid[i][j]!=1)continue;
int curr=1;
forn(k,j+1,m){
if(grid[i][k]!=1)break;
curr=max(curr,k-j+down[i][k]);
}
ans=max(ans,curr);
}
}
cout<<max(0,ans);
// forn(i,0,n){
// for(int j=m-1;j>=0;j--){
// }
// }
}
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
int t=1;
// cin >> t;
forn(i,0,t){
solve();
}
#ifdef ONPC
cerr << endl
<< "finished in " << clock() * 1.0 / CLOCKS_PER_SEC << " sec" << endl;
#endif
}
vjudge1