# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
833377 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 1084 ms | 31052 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
const int MX = 2505;
char inp[MX][MX];
int board[MX][MX];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int n,m;
cin >> n >> m;
for(int i =1 ; i<= n ; i++)
{
for(int j =1 ; j <= m;j++)
{
cin >> inp[i][j];
board[i][j] = inp[i][j] - '0';
board[i][j] += board[i][j-1];
}
}
for(int i =1 ; i<= n ; i++)
{
for(int j =1 ; j <= m;j++)
{
board[i][j] += board[i-1][j];
}
}
// for(int i =1 ; i<= n ; i++)
// {
// for(int j =1 ; j <= m;j++)
// {
// cout << board[i][j] <<" ";
// }
// cout << "\n";
// }
int ans = 0;
for(int h = 1; h <= n; h++)
{
for(int w = 1; w <= m ; w++)
{
bool ok = 1;
for(int i =1 ; i<= n ; i++)
{
for(int j =1 ; j <= m;j++)
{
if(inp[i][j] != '1' || inp[i-1][j] == '1' || inp[i][j-1] == '1'){
continue;
}
int sum = board[i+h-1][j+w-1];
sum -= board[i-1][j+w-1];
sum -= board[i+h-1][j-1];
sum += board[i-1][j-1];
if(sum != h*w)
{
// if(h == 3 && w == 1){
// cout << i << " " <<j ;
// }
ok = 0;
break;
}
}
if(!ok){
break;
}
}
if(ok){
ans = max(ans, h*w);
}
}
}
cout << ans;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |