結果
問題 | No.2822 Lights Up! (Tree Edition) |
ユーザー | chineristAC |
提出日時 | 2024-07-26 21:34:24 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,354 bytes |
コンパイル時間 | 135 ms |
コンパイル使用メモリ | 82,560 KB |
実行使用メモリ | 104,992 KB |
最終ジャッジ日時 | 2024-07-26 21:34:38 |
合計ジャッジ時間 | 12,866 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 45 ms
56,316 KB |
testcase_01 | AC | 43 ms
56,208 KB |
testcase_02 | AC | 156 ms
94,908 KB |
testcase_03 | WA | - |
testcase_04 | AC | 159 ms
95,808 KB |
testcase_05 | AC | 190 ms
96,028 KB |
testcase_06 | AC | 155 ms
104,992 KB |
testcase_07 | WA | - |
testcase_08 | WA | - |
testcase_09 | AC | 139 ms
91,632 KB |
testcase_10 | WA | - |
testcase_11 | WA | - |
testcase_12 | AC | 133 ms
94,108 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | AC | 63 ms
73,748 KB |
testcase_18 | WA | - |
testcase_19 | AC | 59 ms
70,612 KB |
testcase_20 | AC | 71 ms
78,016 KB |
testcase_21 | WA | - |
testcase_22 | AC | 72 ms
78,344 KB |
testcase_23 | AC | 74 ms
78,432 KB |
testcase_24 | AC | 65 ms
74,220 KB |
testcase_25 | WA | - |
testcase_26 | AC | 71 ms
78,084 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | AC | 70 ms
75,144 KB |
testcase_32 | AC | 76 ms
78,096 KB |
testcase_33 | AC | 78 ms
78,020 KB |
testcase_34 | WA | - |
testcase_35 | AC | 73 ms
78,208 KB |
testcase_36 | WA | - |
testcase_37 | AC | 75 ms
78,276 KB |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | WA | - |
testcase_41 | AC | 74 ms
78,180 KB |
testcase_42 | AC | 80 ms
78,204 KB |
testcase_43 | AC | 75 ms
77,908 KB |
testcase_44 | AC | 71 ms
78,252 KB |
testcase_45 | AC | 77 ms
78,220 KB |
testcase_46 | AC | 78 ms
78,156 KB |
testcase_47 | WA | - |
testcase_48 | WA | - |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | AC | 51 ms
65,424 KB |
testcase_52 | AC | 53 ms
66,360 KB |
testcase_53 | WA | - |
testcase_54 | AC | 52 ms
65,764 KB |
testcase_55 | WA | - |
testcase_56 | AC | 53 ms
64,648 KB |
testcase_57 | AC | 52 ms
65,268 KB |
testcase_58 | AC | 52 ms
66,440 KB |
testcase_59 | AC | 57 ms
66,672 KB |
testcase_60 | AC | 51 ms
64,952 KB |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | AC | 51 ms
65,732 KB |
testcase_64 | AC | 52 ms
66,304 KB |
testcase_65 | AC | 49 ms
64,976 KB |
testcase_66 | WA | - |
testcase_67 | WA | - |
testcase_68 | WA | - |
testcase_69 | WA | - |
testcase_70 | WA | - |
testcase_71 | AC | 60 ms
67,176 KB |
testcase_72 | WA | - |
testcase_73 | WA | - |
testcase_74 | AC | 52 ms
65,496 KB |
testcase_75 | AC | 52 ms
65,592 KB |
testcase_76 | WA | - |
testcase_77 | WA | - |
testcase_78 | WA | - |
testcase_79 | AC | 51 ms
65,252 KB |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | AC | 43 ms
57,988 KB |
testcase_83 | WA | - |
testcase_84 | AC | 44 ms
56,520 KB |
testcase_85 | AC | 44 ms
56,792 KB |
testcase_86 | WA | - |
testcase_87 | WA | - |
testcase_88 | AC | 45 ms
56,516 KB |
testcase_89 | AC | 45 ms
57,224 KB |
testcase_90 | WA | - |
testcase_91 | WA | - |
testcase_92 | AC | 44 ms
56,876 KB |
testcase_93 | WA | - |
testcase_94 | WA | - |
testcase_95 | AC | 47 ms
56,564 KB |
testcase_96 | AC | 43 ms
56,496 KB |
testcase_97 | AC | 44 ms
56,924 KB |
testcase_98 | WA | - |
testcase_99 | AC | 47 ms
58,280 KB |
testcase_100 | WA | - |
testcase_101 | WA | - |
testcase_102 | WA | - |
testcase_103 | AC | 44 ms
56,780 KB |
testcase_104 | AC | 43 ms
56,624 KB |
testcase_105 | WA | - |
testcase_106 | WA | - |
testcase_107 | WA | - |
testcase_108 | WA | - |
testcase_109 | WA | - |
testcase_110 | WA | - |
testcase_111 | WA | - |
testcase_112 | AC | 50 ms
64,392 KB |
testcase_113 | AC | 53 ms
66,648 KB |
testcase_114 | WA | - |
testcase_115 | WA | - |
testcase_116 | AC | 53 ms
64,068 KB |
testcase_117 | WA | - |
testcase_118 | AC | 51 ms
64,712 KB |
testcase_119 | AC | 51 ms
65,056 KB |
testcase_120 | WA | - |
testcase_121 | WA | - |
testcase_122 | WA | - |
testcase_123 | AC | 51 ms
64,124 KB |
testcase_124 | WA | - |
testcase_125 | WA | - |
testcase_126 | AC | 51 ms
64,268 KB |
testcase_127 | WA | - |
testcase_128 | AC | 57 ms
66,228 KB |
testcase_129 | WA | - |
testcase_130 | WA | - |
testcase_131 | AC | 52 ms
65,008 KB |
testcase_132 | WA | - |
testcase_133 | AC | 54 ms
64,864 KB |
testcase_134 | AC | 53 ms
64,924 KB |
testcase_135 | WA | - |
testcase_136 | AC | 53 ms
64,976 KB |
testcase_137 | WA | - |
testcase_138 | AC | 51 ms
64,452 KB |
testcase_139 | AC | 56 ms
65,220 KB |
testcase_140 | AC | 54 ms
65,364 KB |
testcase_141 | AC | 54 ms
65,380 KB |
testcase_142 | AC | 50 ms
65,328 KB |
testcase_143 | AC | 53 ms
66,116 KB |
ソースコード
import sys from itertools import permutations from heapq import * from collections import deque import random import bisect from math import factorial input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) def solve(N,P,S,K,op): parent = [-1] + [p-1 for p in P] flip = [0] * N tmp_sum = [0] * N for i in range(1,N)[::-1]: check = int(S[i-1] == "#") flip[i] = check ^ (tmp_sum[i] & 1) tmp_sum[parent[i]] += tmp_sum[i] + check edge = [[] for v in range(N)] for u,v in op: edge[u-1].append(v-1) edge[v-1].append(u-1) for x in range(2): flip[0] = x visit = [False] * N for s in range(N): if visit[s]: continue st = [s] tmp = 0 visit[s] = True while st: v = st.pop() tmp ^= flip[v] for nv in edge[v]: if not visit[nv]: visit[nv] = True st.append(nv) if tmp == 1: break else: return "Yes" return "No" N = int(input()) P = li() S = input() K = int(input()) op = [tuple(mi()) for i in range(K)] print(solve(N,P,S,K,op))