結果

問題 No.459 C-VS for yukicoder
ユーザー te-shte-sh
提出日時 2017-12-06 17:40:01
言語 D
(dmd 2.105.2)
結果
WA  
実行時間 -
コード長 1,228 bytes
コンパイル時間 1,247 ms
コンパイル使用メモリ 101,380 KB
実行使用メモリ 6,124 KB
最終ジャッジ日時 2023-09-03 17:16:18
合計ジャッジ時間 15,386 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

import std.algorithm, std.conv, std.range, std.stdio, std.string;

void main()
{
  auto rd = readln.split.to!(int[]), h = rd[0], w = rd[1], n = rd[2];

  auto b = new int[](w);
  foreach (i; 0..h) {
    auto s = readln.chomp;
    foreach (j; 0..w)
      if (s[j] == '#' && !b[j])
        b[j] = h-i;
  }

  struct Pack { int i, c; int[] b; }
  auto packs = new Pack[](n);
  foreach (i; 0..n) {
    auto c = readln.chomp.to!int;
    packs[i] = Pack(i, c, new int[](3));
  }

  packs.sort!"a.c < b.c";

  auto bi = 0, bj = 0;
  foreach (i; 0..w) {
    while (bi < n && packs[bi].c < i - 2) ++bi;
    while (bj < n && packs[bi].c <= i) ++bj;
    if (b[i] < bj-bi) {
      auto r = b[i];
      foreach (bk; bi..bj) {
        if (r == 0)
          break;
        if (packs[bk].b[i-packs[bk].c] == 0) {
          ++packs[bk].b[i-packs[bk].c];
          --r;
        }
      }
      foreach (bk; bi..bi+r)
        ++packs[bk].b[i-packs[bk].c];
    } else {
      foreach (bk; bi..bj)
        packs[bk].b[i-packs[bk].c] = b[i]/(bj-bi) + (bk-bi < b[i]%(bj-bi));
    }
  }

  packs.sort!"a.i < b.i";

  foreach (pack; packs)
    foreach (i; 0..3) {
      foreach (j; 0..3)
        write(pack.b[j] > i ? "#" : ".");
      writeln;
    }
}
0