提出 #51344061


ソースコード 拡げる

#C
s = input()
size = len(s)
n = len(set(list(s)))
chk = [0]*26
for i in s:
    chk[ord(i)-97] += 1
total = size*(size-1)//2
flag = 0
for i in chk:
    if i >= 2:
        total -= i*(i-1)//2
        flag = 1
if flag == 1:
    total += 1

print(total)

提出情報

提出日時
問題 C - One Time Swap
ユーザ kkigon
言語 Python (CPython 3.11.4)
得点 350
コード長 266 Byte
結果 AC
実行時間 126 ms
メモリ 18380 KiB

ジャッジ結果

セット名 Sample All
得点 / 配点 0 / 0 350 / 350
結果
AC × 2
AC × 24
セット名 テストケース
Sample example_00.txt, example_01.txt
All example_00.txt, example_01.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt
ケース名 結果 実行時間 メモリ
example_00.txt AC 10 ms 8488 KiB
example_01.txt AC 10 ms 8420 KiB
hand_00.txt AC 124 ms 17492 KiB
hand_01.txt AC 10 ms 8532 KiB
hand_02.txt AC 10 ms 8388 KiB
hand_03.txt AC 10 ms 8492 KiB
hand_04.txt AC 10 ms 8460 KiB
hand_05.txt AC 114 ms 17476 KiB
hand_06.txt AC 119 ms 17440 KiB
random_00.txt AC 10 ms 8500 KiB
random_01.txt AC 10 ms 8584 KiB
random_02.txt AC 10 ms 8456 KiB
random_03.txt AC 10 ms 8480 KiB
random_04.txt AC 10 ms 8432 KiB
random_05.txt AC 115 ms 17496 KiB
random_06.txt AC 116 ms 17504 KiB
random_07.txt AC 125 ms 17428 KiB
random_08.txt AC 115 ms 18364 KiB
random_09.txt AC 115 ms 18376 KiB
random_10.txt AC 126 ms 17440 KiB
random_11.txt AC 117 ms 17508 KiB
random_12.txt AC 121 ms 18380 KiB
random_13.txt AC 118 ms 17464 KiB
random_14.txt AC 114 ms 17416 KiB