# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
833286 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 92 ms | 6608 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define int long long
#define vi vector<int>
#define endl "\n"
#define invec(name, n) for(int abc = 0; abc < n; abc++) cin >> name[abc];
#define outvec(name, n) for(int abc = 0; abc < n; abc++) cout << name[abc] << " ";
#define format_decimal(x) fixed << setprecision(x)
using namespace std;
void solve()
{
int n, m;
cin >> n >> m;
vector<vector<char>> mat(n, vector<char>(m));
for(int i = 0; i < n; i++)
{
for(int j = 0; j < m; j++)
{
cin >> mat[i][j];
}
}
int ver = n;
int ctr = 0;
// check per row
for(int i = 0; i < m; i++)
{
for(int j = 0; j < n; j++)
{
if(mat[j][i] == '1') ctr++;
else
{
if(ctr) ver = min(ver, ctr);
ctr = 0;
}
}
if(ctr) ver = min(ver, ctr);
ctr = 0;
}
ctr = 0;
int hor = m;
// check per col
for(int i = 0; i < n; i++)
{
for(int j = 0; j < m; j++)
{
if(mat[i][j] == '1') ctr++;
else
{
if(ctr) hor = min(hor, ctr);
ctr = 0;
}
}
if(ctr) hor = min(hor, ctr);
ctr = 0;
}
cout << hor*ver;
cout << endl;
}
signed main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int t = 1;
//cin >> t;
for(int i = 1; i <= t; i++) solve();
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |