結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 30 ms
9,984 KB
testcase_01 AC 31 ms
9,984 KB
testcase_02 AC 30 ms
9,984 KB
testcase_03 AC 30 ms
9,984 KB
testcase_04 AC 29 ms
9,984 KB
testcase_05 AC 30 ms
9,984 KB
testcase_06 AC 30 ms
9,984 KB
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 31 ms
9,984 KB
testcase_12 AC 30 ms
9,984 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[0]
    elif i==1:
        if x==S[0]:
            return "Yes"
        else:
            return "No"
    else:
        if S[i]==x:
            return calc(i-1,"Yes")
        else:
            return calc(i-1,"No")


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

for i in range(N):
    print(calc(i,S[i]))
0