結果

問題 No.2822 Lights Up! (Tree Edition)
ユーザー achapiachapi
提出日時 2024-06-26 14:49:45
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 679 bytes
コンパイル時間 4,625 ms
コンパイル使用メモリ 267,584 KB
実行使用メモリ 11,008 KB
最終ジャッジ日時 2024-06-26 14:49:54
合計ジャッジ時間 9,256 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
6,812 KB
testcase_01 WA -
testcase_02 AC 92 ms
10,880 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 94 ms
10,880 KB
testcase_07 AC 58 ms
6,940 KB
testcase_08 WA -
testcase_09 AC 72 ms
8,064 KB
testcase_10 AC 51 ms
7,680 KB
testcase_11 WA -
testcase_12 AC 44 ms
6,944 KB
testcase_13 AC 53 ms
6,940 KB
testcase_14 AC 65 ms
7,040 KB
testcase_15 AC 3 ms
6,944 KB
testcase_16 WA -
testcase_17 AC 9 ms
6,940 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 AC 7 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,940 KB
testcase_28 AC 10 ms
6,940 KB
testcase_29 AC 7 ms
6,944 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 AC 10 ms
6,940 KB
testcase_34 WA -
testcase_35 AC 11 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 11 ms
6,944 KB
testcase_42 WA -
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 AC 10 ms
6,944 KB
testcase_47 AC 1 ms
6,944 KB
testcase_48 AC 3 ms
6,944 KB
testcase_49 AC 2 ms
6,940 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 AC 2 ms
6,944 KB
testcase_53 WA -
testcase_54 AC 2 ms
6,940 KB
testcase_55 WA -
testcase_56 WA -
testcase_57 WA -
testcase_58 WA -
testcase_59 WA -
testcase_60 AC 2 ms
6,940 KB
testcase_61 AC 2 ms
6,944 KB
testcase_62 WA -
testcase_63 WA -
testcase_64 WA -
testcase_65 AC 2 ms
6,940 KB
testcase_66 AC 2 ms
6,940 KB
testcase_67 AC 2 ms
6,944 KB
testcase_68 AC 3 ms
6,940 KB
testcase_69 AC 2 ms
6,940 KB
testcase_70 AC 3 ms
6,940 KB
testcase_71 AC 2 ms
6,940 KB
testcase_72 AC 2 ms
6,940 KB
testcase_73 WA -
testcase_74 WA -
testcase_75 AC 3 ms
6,944 KB
testcase_76 AC 3 ms
6,940 KB
testcase_77 AC 3 ms
6,940 KB
testcase_78 WA -
testcase_79 AC 2 ms
6,940 KB
testcase_80 AC 2 ms
6,940 KB
testcase_81 WA -
testcase_82 AC 2 ms
6,940 KB
testcase_83 WA -
testcase_84 WA -
testcase_85 AC 1 ms
6,944 KB
testcase_86 AC 2 ms
6,940 KB
testcase_87 AC 2 ms
6,940 KB
testcase_88 WA -
testcase_89 AC 2 ms
6,944 KB
testcase_90 AC 2 ms
6,940 KB
testcase_91 WA -
testcase_92 AC 2 ms
6,944 KB
testcase_93 AC 2 ms
6,944 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 1 ms
6,944 KB
testcase_100 AC 2 ms
6,940 KB
testcase_101 AC 2 ms
6,944 KB
testcase_102 AC 2 ms
6,944 KB
testcase_103 WA -
testcase_104 AC 2 ms
6,944 KB
testcase_105 AC 2 ms
6,940 KB
testcase_106 AC 1 ms
6,940 KB
testcase_107 AC 1 ms
6,940 KB
testcase_108 AC 2 ms
6,940 KB
testcase_109 AC 2 ms
6,940 KB
testcase_110 AC 2 ms
6,940 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,940 KB
testcase_120 AC 2 ms
6,944 KB
testcase_121 AC 2 ms
6,940 KB
testcase_122 WA -
testcase_123 AC 2 ms
6,940 KB
testcase_124 AC 2 ms
6,944 KB
testcase_125 WA -
testcase_126 AC 3 ms
6,940 KB
testcase_127 WA -
testcase_128 AC 2 ms
6,944 KB
testcase_129 AC 2 ms
6,940 KB
testcase_130 AC 2 ms
6,940 KB
testcase_131 AC 2 ms
6,944 KB
testcase_132 WA -
testcase_133 WA -
testcase_134 AC 2 ms
6,944 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,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
using namespace std;
int main(){
	int N;
	cin >> N;
	vector<int> P(N);
	for (int i = 1; i < N; i++){
		cin >> P[i];
		P[i]--;
	}
	string S;
	cin >> S;
	S = '.' + S;
	vector<int> A(N);
	for (int i = 1; i < N; i++){
		if (S[i] == '#'){
			A[i] = 1;
		}
	}
	atcoder::dsu uf(N);
	int Q;
	cin >> Q;
	while (Q--){
		int U, V;
		cin >> U >> V;
		U--;
		V--;
		uf.merge(U, V);
	}
	
	for (int i = 1; i < N; i++){
		if (S[i] == '#'){
			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;
	}
}
0