結果
問題 | No.179 塗り分け |
ユーザー |
|
提出日時 | 2017-12-11 21:29:10 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,693 bytes |
コンパイル時間 | 689 ms |
コンパイル使用メモリ | 107,100 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 23:00:34 |
合計ジャッジ時間 | 2,868 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 6 |
other | AC * 34 WA * 6 |
コンパイルメッセージ
Main.d(12): Deprecation: foreach: loop index implicitly converted from `size_t` to `int`
ソースコード
import std.stdio, std.string, std.conv, std.algorithm, std.numeric; import std.range, std.array, std.math, std.typecons, std.container, core.bitop; void main() { int h, w; scan(h, w); auto map = new int[][](h, w); foreach (i ; 0 .. h) { string s = readln.chomp; foreach (int j, ch; s) { if (ch == '.') { map[i][j] = 1; } } } foreach (x ; 0 .. h) { foreach (y ; 0 .. w) { if (x + y == 0) continue; bool ok = 1; auto m = new int[][](h, w); iota(h).each!(i => m[i] = map[i].dup); foreach (i ; 0 .. h) { foreach (j ; 0 .. w) { if (m[i][j]) continue; m[i][j] = 2; if (i + x >= h || j + y >= w || m[i+x][j+y]) { ok = 0; } else { m[i + x][j + y] = 3; } } } if (ok) { debug { writefln("%(%(%s %)\n%)", m); writeln(x, " ", y); } writeln("YES"); return; } } } writeln("NO"); } void scan(T...)(ref T args) { string[] line = readln.split; foreach (ref arg; args) { arg = line.front.to!(typeof(arg)); line.popFront(); } assert(line.empty); } void fillAll(R, T)(ref R arr, T value) { static if (is(typeof(arr[] = value))) { arr[] = value; } else { foreach (ref e; arr) { fillAll(e, value); } } }