結果

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

テストケース

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

    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)]

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