結果

問題 No.2000 Distanced Characters
ユーザー titiatitia
提出日時 2022-07-08 21:37:36
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 670 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 10,880 KB
実行使用メモリ 21,288 KB
最終ジャッジ日時 2023-08-27 21:02:04
合計ジャッジ時間 5,728 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 19 ms
12,472 KB
testcase_01 AC 21 ms
7,980 KB
testcase_02 AC 17 ms
8,132 KB
testcase_03 AC 18 ms
8,052 KB
testcase_04 AC 44 ms
8,064 KB
testcase_05 AC 35 ms
8,064 KB
testcase_06 AC 31 ms
7,956 KB
testcase_07 AC 37 ms
8,280 KB
testcase_08 AC 1,545 ms
16,436 KB
testcase_09 TLE -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
import bisect

S=input().strip()
D=[list(map(int,input().split())) for i in range(26)]

LIST=[[] for i in range(26)]
for i in range(len(S)):
    LIST[ord(S[i])-97].append(i)

ANS=[["Y"]*26 for i in range(26)]

for i in range(26):
    for j in range(26):
        flag=1

        for x in LIST[i]:
            y=bisect.bisect_right(LIST[j],x)

            if y==len(LIST[j]):
                continue
            else:
                z=LIST[j][y]

                if x+D[i][j]>z:
                    flag=0
                    break

        if flag==0:
            ANS[i][j]="N"

for i in range(26):
    print(*ANS[i])
            
0