結果
問題 | No.2822 Lights Up! (Tree Edition) |
ユーザー | achapi |
提出日時 | 2024-06-26 14:47:02 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 623 bytes |
コンパイル時間 | 3,981 ms |
コンパイル使用メモリ | 266,260 KB |
実行使用メモリ | 10,880 KB |
最終ジャッジ日時 | 2024-06-26 14:47:12 |
合計ジャッジ時間 | 8,966 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
6,812 KB |
testcase_01 | WA | - |
testcase_02 | AC | 97 ms
10,880 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | AC | 93 ms
10,752 KB |
testcase_07 | AC | 58 ms
6,944 KB |
testcase_08 | WA | - |
testcase_09 | AC | 69 ms
8,064 KB |
testcase_10 | AC | 49 ms
7,680 KB |
testcase_11 | WA | - |
testcase_12 | AC | 43 ms
6,940 KB |
testcase_13 | AC | 50 ms
6,940 KB |
testcase_14 | AC | 64 ms
7,040 KB |
testcase_15 | AC | 3 ms
6,940 KB |
testcase_16 | WA | - |
testcase_17 | AC | 9 ms
6,940 KB |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 8 ms
6,940 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | AC | 3 ms
6,940 KB |
testcase_25 | WA | - |
testcase_26 | AC | 2 ms
6,944 KB |
testcase_27 | AC | 6 ms
6,944 KB |
testcase_28 | AC | 9 ms
6,944 KB |
testcase_29 | AC | 6 ms
6,944 KB |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | AC | 10 ms
6,944 KB |
testcase_34 | WA | - |
testcase_35 | AC | 9 ms
6,940 KB |
testcase_36 | WA | - |
testcase_37 | AC | 10 ms
6,940 KB |
testcase_38 | AC | 10 ms
6,944 KB |
testcase_39 | AC | 10 ms
6,940 KB |
testcase_40 | WA | - |
testcase_41 | AC | 9 ms
6,940 KB |
testcase_42 | WA | - |
testcase_43 | WA | - |
testcase_44 | WA | - |
testcase_45 | WA | - |
testcase_46 | AC | 10 ms
6,944 KB |
testcase_47 | AC | 2 ms
6,944 KB |
testcase_48 | AC | 3 ms
6,940 KB |
testcase_49 | AC | 2 ms
6,944 KB |
testcase_50 | WA | - |
testcase_51 | WA | - |
testcase_52 | AC | 3 ms
6,940 KB |
testcase_53 | WA | - |
testcase_54 | AC | 2 ms
6,948 KB |
testcase_55 | WA | - |
testcase_56 | WA | - |
testcase_57 | WA | - |
testcase_58 | WA | - |
testcase_59 | WA | - |
testcase_60 | AC | 2 ms
6,944 KB |
testcase_61 | AC | 2 ms
6,940 KB |
testcase_62 | WA | - |
testcase_63 | WA | - |
testcase_64 | WA | - |
testcase_65 | AC | 2 ms
6,940 KB |
testcase_66 | AC | 2 ms
6,944 KB |
testcase_67 | AC | 3 ms
6,940 KB |
testcase_68 | AC | 2 ms
6,944 KB |
testcase_69 | AC | 3 ms
6,944 KB |
testcase_70 | AC | 3 ms
6,940 KB |
testcase_71 | AC | 2 ms
6,940 KB |
testcase_72 | AC | 3 ms
6,940 KB |
testcase_73 | WA | - |
testcase_74 | WA | - |
testcase_75 | AC | 2 ms
6,940 KB |
testcase_76 | AC | 2 ms
6,940 KB |
testcase_77 | AC | 2 ms
6,940 KB |
testcase_78 | WA | - |
testcase_79 | AC | 2 ms
6,940 KB |
testcase_80 | AC | 2 ms
6,944 KB |
testcase_81 | WA | - |
testcase_82 | AC | 2 ms
6,940 KB |
testcase_83 | WA | - |
testcase_84 | WA | - |
testcase_85 | AC | 1 ms
6,940 KB |
testcase_86 | AC | 2 ms
6,940 KB |
testcase_87 | AC | 2 ms
6,940 KB |
testcase_88 | WA | - |
testcase_89 | AC | 1 ms
6,940 KB |
testcase_90 | AC | 1 ms
6,944 KB |
testcase_91 | WA | - |
testcase_92 | AC | 2 ms
6,940 KB |
testcase_93 | AC | 2 ms
6,940 KB |
testcase_94 | WA | - |
testcase_95 | WA | - |
testcase_96 | WA | - |
testcase_97 | AC | 2 ms
6,944 KB |
testcase_98 | AC | 2 ms
6,944 KB |
testcase_99 | AC | 2 ms
6,944 KB |
testcase_100 | AC | 1 ms
6,940 KB |
testcase_101 | AC | 2 ms
6,944 KB |
testcase_102 | AC | 2 ms
6,940 KB |
testcase_103 | WA | - |
testcase_104 | AC | 1 ms
6,944 KB |
testcase_105 | AC | 1 ms
6,944 KB |
testcase_106 | AC | 1 ms
6,944 KB |
testcase_107 | AC | 2 ms
6,944 KB |
testcase_108 | AC | 1 ms
6,940 KB |
testcase_109 | AC | 2 ms
6,944 KB |
testcase_110 | AC | 1 ms
6,944 KB |
testcase_111 | WA | - |
testcase_112 | WA | - |
testcase_113 | AC | 2 ms
6,940 KB |
testcase_114 | AC | 2 ms
6,940 KB |
testcase_115 | WA | - |
testcase_116 | WA | - |
testcase_117 | AC | 2 ms
6,944 KB |
testcase_118 | WA | - |
testcase_119 | AC | 2 ms
6,944 KB |
testcase_120 | AC | 2 ms
6,944 KB |
testcase_121 | AC | 2 ms
6,944 KB |
testcase_122 | WA | - |
testcase_123 | AC | 2 ms
6,944 KB |
testcase_124 | AC | 2 ms
6,940 KB |
testcase_125 | WA | - |
testcase_126 | AC | 2 ms
6,940 KB |
testcase_127 | WA | - |
testcase_128 | AC | 2 ms
6,940 KB |
testcase_129 | AC | 2 ms
6,940 KB |
testcase_130 | AC | 2 ms
6,944 KB |
testcase_131 | AC | 2 ms
6,944 KB |
testcase_132 | WA | - |
testcase_133 | WA | - |
testcase_134 | AC | 2 ms
6,940 KB |
testcase_135 | WA | - |
testcase_136 | AC | 2 ms
6,940 KB |
testcase_137 | WA | - |
testcase_138 | WA | - |
testcase_139 | WA | - |
testcase_140 | WA | - |
testcase_141 | WA | - |
testcase_142 | AC | 2 ms
6,944 KB |
ソースコード
#include <bits/stdc++.h> #include <atcoder/all> using namespace std; int main(){ int N; cin >> N; vector<int> P(N - 1); for (int i = 0; i < N - 1; i++){ cin >> P[i]; P[i]--; } string S; cin >> S; atcoder::dsu uf(N); int Q; cin >> Q; while (Q--){ int U, V; cin >> U >> V; U--; V--; uf.merge(U, V); } vector<int> A(N); for (int i = 0; i < N - 1; i++){ if (S[i] == '#'){ A[i + 1] ^= 1; A[P[i]] ^= 1; } } bool ok = true; for (auto s : uf.groups()){ int x = 0; for (int v : s){ x ^= A[v]; } ok |= x; } if (ok){ cout << "Yes" << endl; } else { cout << "No" << endl; } }