Submission #833532

#TimeUsernameProblemLanguageResultExecution timeMemory
833532vjudge1Bomb (IZhO17_bomb)C++17
8 / 100
64 ms19088 KiB
#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 timeMemoryGrader output
Fetching results...