| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 | 
|---|---|---|---|---|---|---|---|
| 38944 | touristk2000 | Bomb (IZhO17_bomb) | C++14 | 0 ms | 49992 KiB | 
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <stdio.h>
const int maxn = 2501;
int dp[maxn][maxn];
int a[maxn][maxn];
int p[maxn];
int t;///;[maxn];
int n, m, res = 1;
bool check(int i, int j){
            for(int c = 1; c <= m; c ++) p[c] = n + 1;
            bool f = true;
            for(int I = n; I >= 1 && f; I --){
                int q = m + 1;
                for(int J = m; J >= 1 && f; J --){
                    if(I>=i&&J>=j){
                    if(dp[I][J] - dp[I-i][J] - dp[I][J-j] + dp[I-i][J-j] == i * j){
                        q = J - j;
                    }}
                    if(J > q) p[J] = I-i;
                    if(a[I][J] && p[J] >= I) f = false;
                }
            }
            return f;
}
int main(){
    freopen("bomb.in", "r", stdin);
    freopen("bomb.out", "w", stdout);
    char c;
    scanf("%d%d", &n, &m);
    for(int i = 1; i <= n; i ++){
        c = getchar();
        for(int j = 1; j <= m; j ++){
            a[i][j] = dp[i][j] = getchar() - '0';
            dp[i][j] += dp[i-1][j] + dp[i][j-1] - dp[i-1][j-1];
        }
    }
    t = m;
    ///for(int i = 1; i <= m; i ++)t[i] = m;
    for(int i = 1; i <= n; i ++){
        int L = 1, R = t, M;
        while(L <= R){
            M = (L + R) >> 1;
            if(check(i, M)){
                if(i * M > res) res = i * M;
                L = M + 1;
            }else
            R = M - 1;
        }
        t = R;
    }
    printf("%d", res);
    return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
