結果
問題 | No.2535 多重同値 |
ユーザー |
![]() |
提出日時 | 2023-11-11 19:20:04 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 113 ms / 2,000 ms |
コード長 | 1,059 bytes |
コンパイル時間 | 194 ms |
コンパイル使用メモリ | 82,432 KB |
実行使用メモリ | 83,968 KB |
最終ジャッジ日時 | 2024-09-26 02:50:49 |
合計ジャッジ時間 | 2,140 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 20 |
ソースコード
from collections import *import sysimport heapqimport bisectimport itertoolsdxdy1 = ((0, 1), (0, -1), (1, 0), (-1, 0))dxdy2 = ((0, 1), (0, -1), (1, 0), (-1, 0), (1, 1), (-1, -1), (1, -1), (-1, 1))dxdy3 = ((0, 1), (1, 0))dxdy4 = ((1, 1), (1, -1), (-1, 1), (-1, -1))INF = float("inf")MOD = 998244353mod = 998244353MOD2 = 10**9 + 7mod2 = 10**9 + 7# memo : len([a,b,...,z])==26input = lambda: sys.stdin.readline().rstrip()mi = lambda: map(int, input().split())li = lambda: list(mi())N = int(input())P = [input() == "Yes" for _ in range(N)]ans = []tmp = P[N - 1]for i in range(N - 2, -1, -1):if tmp == P[i]:tmp = Trueelse:tmp = False# print(tmp)ans.append(tmp)for i in range(N - 2, -1, -1):rev = Falseif P[i]:if P[i] != P[i + 1]:rev = Trueelse:if P[i] == P[i + 1]:rev = Trueif rev:ans.append(ans[-1] ^ True)else:ans.append(ans[-1])ans.reverse()for a in ans:if a:print("Yes")else:print("No")