結果

問題 No.2535 多重同値
ユーザー titiatitia
提出日時 2023-11-11 00:23:15
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 470 bytes
コンパイル時間 198 ms
コンパイル使用メモリ 11,904 KB
実行使用メモリ 48,920 KB
最終ジャッジ日時 2023-11-11 00:23:19
合計ジャッジ時間 3,150 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 31 ms
10,112 KB
testcase_01 AC 31 ms
10,112 KB
testcase_02 AC 30 ms
10,112 KB
testcase_03 AC 30 ms
10,112 KB
testcase_04 AC 29 ms
10,112 KB
testcase_05 AC 30 ms
10,112 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 30 ms
10,112 KB
testcase_09 AC 30 ms
10,112 KB
testcase_10 WA -
testcase_11 WA -
testcase_12 AC 30 ms
10,112 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
sys.setrecursionlimit(10**7)
from functools import lru_cache
@lru_cache(maxsize=None)
def calc(i,x):
    if i==0:
        return S[x]
    elif i==1:
        return x

    else:
        if S[i-1]==x:
            return calc(i-1,"Yes")
        else:
            return calc(i-1,"No")


N=int(input())
S=[input().strip() for i in range(N)]

print(S[0])
for i in range(1,N):
    if S[i]==S[i-1]:
        print(calc(i,"Yes"))
    else:
        print(calc(i,"No"))
0