結果

問題 No.1994 Confusing Name
ユーザー MasKoaTSMasKoaTS
提出日時 2023-10-31 23:13:19
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 488 ms / 2,000 ms
コード長 579 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 81,900 KB
実行使用メモリ 90,656 KB
最終ジャッジ日時 2023-10-31 23:13:28
合計ジャッジ時間 8,890 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
60,412 KB
testcase_01 AC 40 ms
60,228 KB
testcase_02 AC 42 ms
60,172 KB
testcase_03 AC 36 ms
53,616 KB
testcase_04 AC 36 ms
53,616 KB
testcase_05 AC 55 ms
64,712 KB
testcase_06 AC 60 ms
66,760 KB
testcase_07 AC 50 ms
64,680 KB
testcase_08 AC 56 ms
66,760 KB
testcase_09 AC 59 ms
66,760 KB
testcase_10 AC 57 ms
66,780 KB
testcase_11 AC 58 ms
64,704 KB
testcase_12 AC 346 ms
87,372 KB
testcase_13 AC 433 ms
90,288 KB
testcase_14 AC 430 ms
90,092 KB
testcase_15 AC 477 ms
85,972 KB
testcase_16 AC 397 ms
85,936 KB
testcase_17 AC 488 ms
86,028 KB
testcase_18 AC 428 ms
90,616 KB
testcase_19 AC 428 ms
90,604 KB
testcase_20 AC 452 ms
90,656 KB
testcase_21 AC 127 ms
78,648 KB
testcase_22 AC 100 ms
77,040 KB
testcase_23 AC 379 ms
89,520 KB
testcase_24 AC 371 ms
89,088 KB
testcase_25 AC 315 ms
84,932 KB
testcase_26 AC 156 ms
79,044 KB
testcase_27 AC 345 ms
87,304 KB
testcase_28 AC 339 ms
85,736 KB
testcase_29 AC 84 ms
72,908 KB
testcase_30 AC 385 ms
85,948 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
ctoi = { chr(i + ord('a')) : i + 1 for i in range(26) }

n = int(input())
s = []
st = set([])
for _ in [0] * n:
    num = 0
    lis = []
    b = 1
    for c in input()[:-1]:
        lis.append(ctoi[c])
        num += b * ctoi[c]
        b *= 27
    lis.append(num)
    s.append(lis)
    st.add(num)
    
for lis in s:
    num = lis.pop()
    ans = 0
    b = 1
    for x in lis:
        for j in range(1, 27):
            if(j == x or num + b * (j - x) not in st):
                continue
            ans += 1
        b *= 27
    print(ans)
0