# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
833532 | vjudge1 | Bomb (IZhO17_bomb) | C++17 | 64 ms | 19088 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define ll long long
#define endl "\n"
#define pb push_back
#define pf push_front
#define p push
#define q queue
#define popf pop_front()
#define popb pop_back()
#define dq deque
#define fi first
#define se second
#define ve vector
#define lb lower_bound
#define ub upper_bound
#define pq priority_queue
#define st stack
#define rep(i,a,b) for (ll i=a; i<b; i++)
#define rept(i,a,b) for (ll i=a; i<=b; i++)
#define repr(i,a,b) for (ll i=a; i>=b; i--)
#define ppi pair<ll,ll>
#define test cout<<"A"<<endl
using namespace std;
ll a,b;
ve<string> mp;
ve<string> hor;
ve<string> ver;
int main(){
ios_base::sync_with_stdio(false);
// cin.tie(NULL);
cin>>a>>b;
rep(i,0,a){
string s;
cin>>s;
mp.pb(s);
hor.pb(s);
ver.pb(s);
}
rep(i,0,a){
rep(j,0,b){
if (mp[i][j] == '1'){
if (i != 0){
ver[i][j]+= ver[i-1][j]-'0';
ver[i-1][j] = '0';
}
if (j != 0){
hor[i][j]+= hor[i][j-1]-'0';
hor[i][j-1] = '0';
}
}
}
}
ll ans = 1e9;
rep(i,0,a){
rep(j,0,b){
ll temp = ver[i][j]-'0';
if (temp == 0) temp = 99999;
ans = min(ans, temp);
}
}
if (ans == 99999){
ans = 0;
}
ll k = 1e9;
rep(i,0,a){
rep(j,0,b){
ll temp = hor[i][j]-'0';
if (temp == 0) temp = 99999;
k = min(k, temp);
}
}
if (k==99999){
k = 0;
}
cout<<ans*k<<endl;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |