結果

問題 No.459 C-VS for yukicoder
ユーザー tubo28tubo28
提出日時 2016-12-04 19:01:07
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,890 bytes
コンパイル時間 1,877 ms
コンパイル使用メモリ 173,904 KB
実行使用メモリ 8,472 KB
最終ジャッジ日時 2023-08-19 06:03:19
合計ジャッジ時間 8,603 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
8,472 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 2 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 2 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 1 ms
4,380 KB
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 1 ms
4,380 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 2 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 WA -
testcase_20 WA -
testcase_21 RE -
testcase_22 RE -
testcase_23 TLE -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
testcase_55 -- -
testcase_56 -- -
testcase_57 -- -
testcase_58 -- -
testcase_59 -- -
testcase_60 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)
#define all(c) begin(c), end(c)
#define dump(x) //cerr << __LINE__ << ":\t" #x " = " << x << endl

void validate_range(int x, int l, int r) {
    assert(l <= x && x <= r);
}

int H, W, N;
vector<string> S;
int C[10010]; // パックiが置かれた列

int need[10010]; // i列目に必要なブロックの数
vector<int> pack[10010]; // i列目に置かれたパックの集合
int cnt[10010]; // パックiが含むブロックの数
int cntc[10010][3]; // パックiがj列目に含むブロックの数

int main() {
    cin >> H >> W >> N;
    validate_range(H, 1, 10000);
    validate_range(W, 3, 10000);
    S.assign(H, "");
    rep(i, H){
        cin >> S[i];
        validate_range(S[i].size(), W, W);
        dump(S[i]);
    }
    rep(j, W) rep(i, H) if(S[i][j] == '#') ++need[j];
    rep(i, N) {
        cin >> C[i];
        validate_range(C[i], 0, W-3);
        rep(j, 3) pack[C[i]+j].push_back(i);
    }

    rep(j, W){
        dump(j);
        auto &ps = pack[j];
        sort(all(pack[j]), [&](int a, int b){
                return cnt[a] < cnt[b];
            });
        int jj = 0;
        while(jj < need[j]){
            int p = ps[jj % ps.size()];
            dump(p);
            dump(C[p]);
            int rj = j - C[p];
            // validate_range(rj, 0, 2);
            if(cntc[p][rj] == 3) continue;
            ++cnt[p];
            ++cntc[p][rj];
            ++jj;
        }
    }

    rep(x, N){
        // validate_range(cnt[x], 1, 9);
        dump(cnt[x]);
        char ans[3][4] = { "...", "...", "..." };
        rep(j, 3){
            // validate_range(cntc[x][j], 0, 3);
            dump(cntc[x][j]);
            rep(i, cntc[x][j]){
                ans[i][j] = '#';
            }
        }
        rep(i, 3) puts(ans[i]);
    }
}
0