Submission #992899


Source Code Expand

#include <iostream>
#include <vector>
#include <stdlib.h>
#include <math.h>
#include <algorithm>
#include <queue>
using namespace std;

bool ok[100001][100001];
int l[100000];

int main() {


	bool reached[100001];
	int n, m;
	cin >> n >> m;

	int k;

	for (int i = 0; i < m; i++) {
		reached[i] = true;
	}

	for (int i = 0; i < n; i++) {
		cin >> k;
		for (int x = 0; x < k; x++) {
			cin >> l[x];
			reached[l[x]] = false;
		}
		// sort(l, l + k);

		for (int dist = 0; dist < k-1; dist++) {
			for (int sorce = dist + 1; sorce < k; sorce++) {
				int x = l[dist];
				int y = l[sorce];
				ok[x][y] = true;
				ok[y][x] = true;
			}
		}
	}

	queue<int> queue;
	queue.push(1);
	reached[1] = true;
	while (!queue.empty()) {
		int target;
		target = queue.front();
		queue.pop();
		for (int i = 1; i <= m; i++) {
			if (ok[target][i] == false) {
				continue;
			}
			if (reached[i] == true) {
				//ignore
			}
			else {
				queue.push(i);
				reached[i] = true;
			}
		}
	}

	for (int i = 1; i <= m; i++) {
		if (reached[i] == false) {
			cout << "NO" << endl;
			return 0;
		}
	}
	cout << "YES" << endl;
	return 0;
}

Submission Info

Submission Time
Task C - Interpretation
User ysakasin
Language C++14 (Clang 3.8.0)
Score 0
Code Size 1192 Byte
Status CE

Compile Error

/tmp/Main-5c1638.o: In function `main':
./Main.cpp:(.text+0x83): relocation truncated to fit: R_X86_64_32 against symbol `l' defined in .bss section in /tmp/Main-5c1638.o
./Main.cpp:(.text+0x10e): relocation truncated to fit: R_X86_64_32S against symbol `l' defined in .bss section in /tmp/Main-5c1638.o
./Main.cpp:(.text+0x11f): relocation truncated to fit: R_X86_64_32S against symbol `l' defined in .bss section in /tmp/Main-5c1638.o
./Main.cpp:(.text+0x154): relocation truncated to fit: R_X86_64_32S against symbol `l' defined in .bss section in /tmp/Main-5c1638.o
./Main.cpp:(.text+0x17a): relocation truncated to fit: R_X86_64_32S against symbol `l' defined in .bss section in /tmp/Main-5c1638.o
clang-3.8: error: linker command failed with exit code 1 (use -v to see invocation)