結果

問題 No.2780 The Bottle Imp
ユーザー ooaiu
提出日時 2025-07-10 02:40:28
言語 C++23
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 617 bytes
コンパイル時間 3,550 ms
コンパイル使用メモリ 280,864 KB
実行使用メモリ 9,056 KB
最終ジャッジ日時 2025-07-10 02:40:36
合計ジャッジ時間 7,536 ms
ジャッジサーバーID
(参考情報)
judge4 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 36 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
	std::ios_base::sync_with_stdio(false);
	std::cin.tie(nullptr);
	int N;
	cin >> N;
	vector<vector<int>> G(N);
	for(int i = 0; i < N; i++) {
		int m;
		cin >> m;
		while(m--) {
			int a;
			cin >> a;
			a--;
			G[i].push_back(a);
		}
	}
	queue<int> que;
	que.push(0);
	vector<int> vis(N);
	vis[0] = 1;
	while(!que.empty()) {
		int v = que.front();
		que.pop();
		for(int u: G[v]) if(!vis[u]) {
			vis[u] = 1;
			que.push(u);
		}
	}
	bool ok = true;
	for(int i = 0; i < N; i++) if(!vis[i]) ok = false;
	cout << (ok ? "Yes\n": "No\n");
}

0