結果

問題 No.2535 多重同値
ユーザー yupoohyupooh
提出日時 2023-11-10 22:14:14
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 634 bytes
コンパイル時間 283 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 81,912 KB
最終ジャッジ日時 2023-11-10 22:14:17
合計ジャッジ時間 2,145 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

import sys
input = sys.stdin.readline
n=int(input())
P=[]
for i in range(n):
  p=input().rstrip()
  if n==1:
    print(p)
    exit()
  if p=="Yes":
    P.append(1)
  else:
    P.append(0)
memo=[0]*n
for i in range(n-2,-1,-1):
  if P[i]==P[i+1]:
    flg=1
  else:
    flg=0
  if flg==P[i]:
    memo[i]=memo[i+1]
  else:
    memo[i]=1-memo[i+1]
if P[-2]==P[-1]:
  now=1
else:
  now=0
for i in range(n-3,-1,-1):
  if now==P[i]:
    now=1
  else:
    now=0
ans=[0]*n
ans[-1]=now
for i in range(n-2,-1,-1):
  if memo[i]==0:
    ans[i]=ans[i+1]
  else:
    ans[i]=1-ans[i+1]
for i in ans:
  if i==0:
    print("No")
  else:
    print("Yes")
0