# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
531870 | nigus | Bomb (IZhO17_bomb) | C++14 | 1090 ms | 5324 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, b, a) for(int i = b - 1; i >= a; i--)
#define trav(a, x) for(auto& a : x)
#define all(x) x.begin(), x.end()
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef long double ld;
typedef unsigned long long ull;
unsigned seed = chrono::system_clock::now().time_since_epoch().count();
mt19937 eng(seed);
ll random2(){
return (1ll << 31ll)*eng()+eng();
}
ll n,m,k,q,T;
const ll big = 1000000007;
const ll big2 = 1000000009;
const ll mod = 998244353;
const int MAXN = 1001;
bool grid[MAXN][MAXN] = {0};
bool covered[MAXN][MAXN] = {0};
bool can_place(int i, int j, int a, int b){
if(n-i < a || m-j < b)return 0;
rep(c1,0,a){
rep(c2,0,b){
if(!grid[i+c1][j+c2])return 0;
}
}
return 1;
}
bool solve(int a, int b){
rep(c1,0,n){
rep(c2,0,m){
if(can_place(c1,c2,a,b)){
//cerr << a << " " << b << ": " << c1+1 << " " << c2+1 << "\n";
rep(c3,0,a){
rep(c4,0,b){
covered[c1+c3][c2+c4] = 1;
}
}
}
}
}
rep(c1,0,n){
rep(c2,0,m){
if(grid[c1][c2] && !covered[c1][c2])return 0;
}
}
return 1;
}
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
// freopen("fhc.txt","r",stdin);
// freopen("autput.txt","w",stdout);
ll a,b,c,d,e;
cin >> n >> m;
rep(c1,0,n){
string s;
cin >> s;
rep(c2,0,m){
grid[c1][c2] = (s[c2] == '1');
}
}
ll ans = 0;
rep(a,1,n+1){
rep(b,1,m+1){
rep(c1,0,n){
rep(c2,0,m){
covered[c1][c2] = 0;
}
}
if(solve(a, b)){
ans = max(ans, (ll)a*b);
}
}
}
cout << ans << "\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |