結果

問題 No.459 C-VS for yukicoder
ユーザー pekempeypekempey
提出日時 2016-12-10 00:27:20
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 864 ms / 2,000 ms
コード長 1,207 bytes
コンパイル時間 2,053 ms
コンパイル使用メモリ 174,620 KB
実行使用メモリ 6,316 KB
最終ジャッジ日時 2023-08-19 06:40:24
合計ジャッジ時間 7,755 ms
ジャッジサーバーID
(参考情報)
judge11 / judge9
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 1 ms
4,376 KB
testcase_03 AC 2 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,380 KB
testcase_06 AC 1 ms
4,380 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 AC 2 ms
4,380 KB
testcase_09 AC 1 ms
4,384 KB
testcase_10 AC 1 ms
4,376 KB
testcase_11 AC 1 ms
4,380 KB
testcase_12 AC 1 ms
4,376 KB
testcase_13 AC 1 ms
4,380 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 1 ms
4,380 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,384 KB
testcase_21 AC 864 ms
6,192 KB
testcase_22 AC 9 ms
6,316 KB
testcase_23 AC 26 ms
6,184 KB
testcase_24 AC 277 ms
4,384 KB
testcase_25 AC 143 ms
4,380 KB
testcase_26 AC 3 ms
4,384 KB
testcase_27 AC 6 ms
4,376 KB
testcase_28 AC 127 ms
4,380 KB
testcase_29 AC 5 ms
4,376 KB
testcase_30 AC 3 ms
4,376 KB
testcase_31 AC 76 ms
4,376 KB
testcase_32 AC 2 ms
4,376 KB
testcase_33 AC 163 ms
4,388 KB
testcase_34 AC 162 ms
4,380 KB
testcase_35 AC 6 ms
4,376 KB
testcase_36 AC 12 ms
4,376 KB
testcase_37 AC 4 ms
4,376 KB
testcase_38 AC 143 ms
4,380 KB
testcase_39 AC 5 ms
4,384 KB
testcase_40 AC 45 ms
4,376 KB
testcase_41 AC 2 ms
4,380 KB
testcase_42 AC 19 ms
4,380 KB
testcase_43 AC 91 ms
4,380 KB
testcase_44 AC 12 ms
4,384 KB
testcase_45 AC 9 ms
4,376 KB
testcase_46 AC 5 ms
4,376 KB
testcase_47 AC 4 ms
4,380 KB
testcase_48 AC 106 ms
4,380 KB
testcase_49 AC 3 ms
4,380 KB
testcase_50 AC 124 ms
4,376 KB
testcase_51 AC 3 ms
4,380 KB
testcase_52 AC 22 ms
4,376 KB
testcase_53 AC 7 ms
4,380 KB
testcase_54 AC 145 ms
4,380 KB
testcase_55 AC 4 ms
4,384 KB
testcase_56 AC 35 ms
4,384 KB
testcase_57 AC 3 ms
4,380 KB
testcase_58 AC 149 ms
4,376 KB
testcase_59 AC 14 ms
4,376 KB
testcase_60 AC 20 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main() {
    int h, w, n;
    cin >> h >> w >> n;

    vector<int> cnt(w);
    for (int i = 0; i < h; i++) {
        char s[10001];
        scanf("%s", s);
        for (int j = 0; j < w; j++) {
            if (s[j] == '#') {
                cnt[j]++;
            }
        }
    }

    vector<string> g(n * 3, string(3, '.'));

    vector<pair<int, int>> c(n);
    for (int i = 0; i < n; i++) {
        scanf("%d", &c[i].first);
        c[i].second = i;
    }

    sort(c.begin(), c.end());

    int j = 0;
    for (int i = 0; i < n; i++) {
        while (j < c[i].first || cnt[j] == 0) {
            j++;
        }
        g[c[i].second * 3][j - c[i].first] = '#';
        cnt[j]--;
    }
    for (int j = 0; j < w; j++) {
        for (int i = 0; i < n; i++) {
            for (int k = 0; k < 3; k++) {
                if (cnt[j] > 0 && c[i].first <= j && j < c[i].first + 3 && g[c[i].second * 3 + k][j - c[i].first] == '.') {
                    g[c[i].second * 3 + k][j - c[i].first] = '#';
                    cnt[j]--;
                }
            }
        }
    }

    for (int i = 0; i < n * 3; i++) {
        printf("%s\n", g[i].data());
    }
}
0