Submission #992795
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]; bool reached[100001]; int main() { 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-efa9d4.o: In function `main': ./Main.cpp:(.text+0x3d): relocation truncated to fit: R_X86_64_32 against symbol `reached' defined in .bss section in /tmp/Main-efa9d4.o ./Main.cpp:(.text+0x73): relocation truncated to fit: R_X86_64_32 against symbol `l' defined in .bss section in /tmp/Main-efa9d4.o ./Main.cpp:(.text+0xa2): relocation truncated to fit: R_X86_64_32S against symbol `reached' defined in .bss section in /tmp/Main-efa9d4.o ./Main.cpp:(.text+0xfe): relocation truncated to fit: R_X86_64_32S against symbol `l' defined in .bss section in /tmp/Main-efa9d4.o ./Main.cpp:(.text+0x10f): relocation truncated to fit: R_X86_64_32S against symbol `l' defined in .bss section in /tmp/Main-efa9d4.o ./Main.cpp:(.text+0x144): relocation truncated to fit: R_X86_64_32S against symbol `l' defined in .bss section in /tmp/Main-efa9d4.o ./Main.cpp:(.text+0x16a): relocation truncated to fit: R_X86_64_32S against symbol `l' defined in .bss section in /tmp/Main-efa9d4.o ./Main.cpp:(.text+0x1f6): relocation truncated ...