# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
833167 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 62 ms | 24908 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> pii;
typedef vector<ll> vll;
typedef pair<ll, ll> pll;
const int MOD = 1000000007;
const int dx[] = {0, 0, 1, -1, 1, -1, -1, 1};
const int dy[] = {1, -1, 0, 0, 1, -1, 1, -1};
#define endl '\n'
#define ff first
#define ss second
#define pb push_back
#define pob pop_back
#define mp make_pair
#define all(x) x.begin(),x.end()
#define lsort(x) sort(all(x))
#define gsort(x) sort(all(x), greater<>())
#define rev(x) reverse(all(x))
#define mset(x, y) memset(x, y, sizeof(x))
#define vin(x, y) for(int i = 0; i < y; i++){decltype(x)::value_type temp; cin >> temp; x.pb(temp);}
#define vout(x) for(auto i : x){cout << i << " ";} cout << endl;
#define decide(x) if(x){ cout << "YES" << endl; }else{ cout << "NO" << endl; }
#define test(x) cout << "..." << endl
template<typename T> void chmin(T& x, T y) {if(x > y) x = y;}
template<typename T> void chmax(T& x, T y) {if(x < y) x = y;}
void fastIO(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
}
int n, m;
int arr[2500][2500];
void solve(){
//IO
cin >> n >> m;
for(int i = 0; i < n; i++){
string temp;
cin >> temp;
for(int j = 0; j < m; j++) arr[i][j] = temp[j] - '0';
}
ll w = LLONG_MAX;
ll l = LLONG_MAX;
for(int i = 0; i < n; i++){
ll curr = 0;
for(int j = 0; j < m; j++){
if(arr[i][j] == 1) curr++;
else{
if(curr > 0) chmin(w, curr);
curr = 0;
}
}
}
for(int i = 0; i < m; i++){
ll curr = 0;
for(int j = 0; j < n; j++){
if(arr[j][i] == 1) curr++;
else{
if(curr > 0) chmin(l, curr);
curr = 0;
}
}
}
cout << w * l << endl;
}
int main(){
fastIO();
int t = 1;
// cin >> t;
while(t--) solve();
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |