結果
問題 | No.2000 Distanced Characters |
ユーザー | 👑 obakyan |
提出日時 | 2022-07-10 22:12:30 |
言語 | Lua (LuaJit 2.1.1696795921) |
結果 |
AC
|
実行時間 | 73 ms / 2,000 ms |
コード長 | 575 bytes |
コンパイル時間 | 370 ms |
コンパイル使用メモリ | 5,332 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-02 06:03:58 |
合計ジャッジ時間 | 1,546 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,380 KB |
testcase_01 | AC | 1 ms
4,384 KB |
testcase_02 | AC | 1 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,384 KB |
testcase_04 | AC | 2 ms
4,384 KB |
testcase_05 | AC | 2 ms
4,384 KB |
testcase_06 | AC | 2 ms
4,380 KB |
testcase_07 | AC | 2 ms
4,384 KB |
testcase_08 | AC | 73 ms
4,384 KB |
testcase_09 | AC | 32 ms
4,384 KB |
testcase_10 | AC | 33 ms
4,380 KB |
testcase_11 | AC | 30 ms
4,380 KB |
testcase_12 | AC | 19 ms
4,384 KB |
testcase_13 | AC | 18 ms
4,384 KB |
testcase_14 | AC | 18 ms
4,380 KB |
ソースコード
local mmi, mma = math.min, math.max local s = io.read() local n = #s local t = {} local inf = 1000000007 for i = 1, 26 do t[i] = {} for j = 1, 26 do t[i][j] = inf end end for i = 1, 26 do local spos = -inf for j = 1, n do local b = s:byte(j) - 96 t[i][b] = mmi(t[i][b], j - spos) if b == i then spos = j end end end for i = 1, 26 do for j = 1, 26 do local z = io.read("*n") local f = z <= t[i][j] io.write(f and "Y" or "N") -- io.write(t[i][j] == inf and "_" or t[i][j]) io.write(j == 26 and "\n" or " ") end end