結果

問題 No.2000 Distanced Characters
ユーザー 👑 rin204rin204
提出日時 2022-09-19 01:40:25
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 197 ms / 2,000 ms
コード長 453 bytes
コンパイル時間 300 ms
コンパイル使用メモリ 86,916 KB
実行使用メモリ 78,804 KB
最終ジャッジ日時 2023-08-23 18:31:37
合計ジャッジ時間 2,904 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 71 ms
71,304 KB
testcase_01 AC 78 ms
76,316 KB
testcase_02 AC 72 ms
71,328 KB
testcase_03 AC 76 ms
71,332 KB
testcase_04 AC 79 ms
76,440 KB
testcase_05 AC 82 ms
76,316 KB
testcase_06 AC 78 ms
76,120 KB
testcase_07 AC 79 ms
75,860 KB
testcase_08 AC 162 ms
78,520 KB
testcase_09 AC 169 ms
78,592 KB
testcase_10 AC 197 ms
78,416 KB
testcase_11 AC 169 ms
78,804 KB
testcase_12 AC 127 ms
76,740 KB
testcase_13 AC 124 ms
76,848 KB
testcase_14 AC 143 ms
77,044 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

S = input()
S = [ord(s) - 97 for s in S]
inf = 1 << 30
mi = [[inf] * 26 for _ in range(26)]
bef = [-inf] * 26
for i, s in enumerate(S):
    for j in range(26):
        mi[j][s] = min(mi[j][s], i - bef[j])
    bef[s] = i

D = [list(map(int, input().split())) for _ in range(26)]
for i in range(26):
    ans = [""] * 26
    for j in range(26):
        if D[i][j] <= mi[i][j]:
            ans[j] = "Y"
        else:
            ans[j] = "N"
    print(*ans)
0