結果

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

テストケース

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

ソースコード

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[bj].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