結果
問題 | No.2000 Distanced Characters |
ユーザー |
![]() |
提出日時 | 2022-07-08 21:55:30 |
言語 | D (dmd 2.109.1) |
結果 |
AC
|
実行時間 | 210 ms / 2,000 ms |
コード長 | 807 bytes |
コンパイル時間 | 2,670 ms |
コンパイル使用メモリ | 216,168 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-22 15:40:38 |
合計ジャッジ時間 | 4,299 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 13 |
ソースコード
import std;void main() {auto S = readln.chomp;int L = 26;auto D = new int[][](L);foreach (i; 0 .. L) D[i] = readln.chomp.split.to!(int[]);auto pos = new int[][](L);foreach (i, s; S) {pos[s-'a'] ~= i.to!int;}auto spos = new SortedRange!(int[], "a < b")[](L);foreach (i; 0 .. L) {spos[i] = pos[i].assumeSorted;}auto res = new dchar[][](L, L);foreach (i; 0 .. L) res[i][] = 'Y';foreach (i, s; S) {int t = s - 'a';foreach (j; 0 .. L) {int num = i.to!int + D[t][j];auto ub = spos[j].lowerBound(num);if (ub.empty) continue;if (ub.back <= i) continue;res[t][j] = 'N';}}foreach (i; 0 .. L) writefln("%(%c %)", res[i]);}