結果
| 問題 |
No.459 C-VS for yukicoder
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2016-12-14 11:25:45 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 35 ms / 2,000 ms |
| コード長 | 1,204 bytes |
| コンパイル時間 | 1,195 ms |
| コンパイル使用メモリ | 135,680 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-06-12 05:32:02 |
| 合計ジャッジ時間 | 4,611 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 58 |
ソースコード
import std.stdio;
import std.array;
import std.string;
import std.conv;
import std.algorithm;
import std.typecons;
import std.range;
import std.random;
import std.math;
import std.container;
import std.numeric;
import std.bigint;
void main() {
alias Tuple!(int, "index", int, "pos", int[3], "block") pack;
auto s = readln.split.map!(to!int);
auto H = s[0];
auto W = s[1];
auto N = s[2];
auto COLS = new int[](W);
foreach (i; 0..H)
foreach (j, c; enumerate(readln.chomp))
if (c == '#')
COLS[j] += 1;
auto P = new pack[](N);
foreach (i; 0..N) {
P[i].index = i;
P[i].pos = readln.chomp.to!int;
}
P.sort!"a.pos < b.pos"();
foreach (i; 0..N)
foreach (j; 0..3)
if (COLS[P[i].pos+j] > 0) {
COLS[P[i].pos+j] -= 1;
P[i].block[j] += 1;
break;
}
foreach (i; 0..N)
foreach (j; 0..3)
while (COLS[P[i].pos+j] > 0 && P[i].block[j] < 3) {
COLS[P[i].pos+j] -= 1;
P[i].block[j] += 1;
}
P.sort!"a.index < b.index"();
foreach (i; 0..N) {
foreach (j; 0..3) {
char[3] line;
foreach (k; 0..3)
line[k] = (P[i].block[k] > j) ? '#' : '.';
line.writeln;
}
}
}