結果
| 問題 |
No.1941 CHECKER×CHECKER(1)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-04-04 11:15:22 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 2 ms / 2,000 ms |
| コード長 | 705 bytes |
| コンパイル時間 | 1,407 ms |
| コンパイル使用メモリ | 157,916 KB |
| 実行使用メモリ | 7,328 KB |
| 最終ジャッジ日時 | 2025-04-04 11:15:26 |
| 合計ジャッジ時間 | 2,333 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 |
ソースコード
import std;
import core.bitop;
import core.checkedint;
import core.time;
const dx = [-1, 1, 0, 0];
const dy = [0, 0, -1, 1];
void main() {
auto s = new string[3];
foreach(i; 0..3) {
s[i] = readln.chomp;
}
bool ok = true;
foreach(i; 0..3) {
foreach(j; 0..3) {
bool check = true;
foreach(k; 0..4) {
const int x = i + dx[k], y = j + dy[k];
if(range(0, x, 3) && range(0, y, 3)) {
check &= s[i][j] != s[x][y];
}
}
ok &= check;
}
}
writeln(yes(ok));
}
pragma(inline)
string yes(const bool b) pure @nogc nothrow @safe {
return b ? "Yes" : "No";
}
pragma(inline)
bool range(const int a, const int x, const int b) pure @nogc nothrow @safe {
return a <= x && x < b;
}