結果

問題 No.2657 Falling Block Game
ユーザー てんぷらてんぷら
提出日時 2024-02-29 00:13:54
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 403 ms / 2,000 ms
コード長 1,416 bytes
コンパイル時間 6,214 ms
コンパイル使用メモリ 310,500 KB
実行使用メモリ 6,676 KB
最終ジャッジ日時 2024-02-29 00:14:08
合計ジャッジ時間 11,842 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
6,676 KB
testcase_01 AC 2 ms
6,676 KB
testcase_02 AC 2 ms
6,676 KB
testcase_03 AC 2 ms
6,676 KB
testcase_04 AC 14 ms
6,676 KB
testcase_05 AC 403 ms
6,676 KB
testcase_06 AC 173 ms
6,676 KB
testcase_07 AC 399 ms
6,676 KB
testcase_08 AC 153 ms
6,676 KB
testcase_09 AC 25 ms
6,676 KB
testcase_10 AC 148 ms
6,676 KB
testcase_11 AC 147 ms
6,676 KB
testcase_12 AC 149 ms
6,676 KB
testcase_13 AC 148 ms
6,676 KB
testcase_14 AC 147 ms
6,676 KB
testcase_15 AC 152 ms
6,676 KB
testcase_16 AC 147 ms
6,676 KB
testcase_17 AC 148 ms
6,676 KB
testcase_18 AC 148 ms
6,676 KB
testcase_19 AC 150 ms
6,676 KB
testcase_20 AC 53 ms
6,676 KB
testcase_21 AC 53 ms
6,676 KB
testcase_22 AC 53 ms
6,676 KB
testcase_23 AC 54 ms
6,676 KB
testcase_24 AC 53 ms
6,676 KB
testcase_25 AC 54 ms
6,676 KB
testcase_26 AC 56 ms
6,676 KB
testcase_27 AC 54 ms
6,676 KB
testcase_28 AC 53 ms
6,676 KB
testcase_29 AC 53 ms
6,676 KB
testcase_30 AC 29 ms
6,676 KB
testcase_31 AC 28 ms
6,676 KB
testcase_32 AC 28 ms
6,676 KB
testcase_33 AC 28 ms
6,676 KB
testcase_34 AC 29 ms
6,676 KB
testcase_35 AC 28 ms
6,676 KB
testcase_36 AC 28 ms
6,676 KB
testcase_37 AC 28 ms
6,676 KB
testcase_38 AC 29 ms
6,676 KB
testcase_39 AC 28 ms
6,676 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <atcoder/all>
#include <bits/stdc++.h>
using ll = long long;
using ull = unsigned long long;
#define rep(i, n) for(int i = 0; i < (int)(n); i++)
#define REP(i, m, n) for(int i = (int)(m); i < (int)(n); i++)
using namespace std;
using namespace atcoder;
using mint = modint998244353;
const int inf = 1000000007;
const ll longinf = 1ll << 60;

int op(int x, int y) {
    return min(x, y);
}

int e() {
    return inf;
}

int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int h, w;
    cin >> h >> w;
    vector<string> s(h);
    rep(i, h) cin >> s[i];
    vector<int> dp(w, 0);
    for(int i = h - 2; i >= 0; i--) {
        vector<int> ndp(w, inf);
        atcoder::segtree<int, op, e> sg(dp);
        int l = 0, r = 0;
        rep(j, w) {
            if(s[i][j] == '#') {
                l = j + 1;
                r = j + 1;
                continue;
            }
            while(r < w && s[i][r] == '.')
                ++r;
            int ok = w, ng = -1;
            while(ok - ng > 1) {
                int mid = (ok + ng) / 2;
                int val = sg.prod(max(l, j - mid), min(r, j + mid + 1));
                if(val <= mid) {
                    ok = mid;
                } else {
                    ng = mid;
                }
            }
            ndp[j] = ok;
        }
        dp.swap(ndp);
    }
    rep(i, w) cout << dp[i] << "\n";
    return 0;
}
0