Submission #991612
Source Code Expand
#include <cstdio> #include <cstdlib> #include <cstring> #include <cmath> #include <cassert> #include <iostream> #include <sstream> #include <vector> #include <queue> #include <set> #include <map> #include <utility> #include <numeric> #include <algorithm> #include <bitset> #include <complex> #include <array> #include <list> #include <stack> #include <valarray> using namespace std; typedef unsigned uint; typedef long long Int; typedef unsigned long long UInt; const int INF = 1001001001; const Int INFLL = 1001001001001001001LL; template<typename T> void pv(T a, T b) { for (T i = a; i != b; ++i) cout << *i << " "; cout << endl; } template<typename T> void chmin(T& a, T b) { if (a > b) a = b; } template<typename T> void chmax(T& a, T b) { if (a < b) a = b; } int in() { int x; scanf("%d", &x); return x; } double fin() { double x; scanf("%lf", &x); return x; } Int lin() { Int x; scanf("%lld", &x); return x; } int U[100050]; void init(int n) { for (int i = 0; i < n; ++i) { U[i] = i; } } int find(int x) { return U[x] == x ? x : U[x] = find(U[x]); } void uni(int x, int y) { U[find(x)] = find(y); } vector<int> A[100050]; int main() { int N = in(); int M = in(); for (int i = 0; i < N; ++i) { int K = in(); for (int j = 0; j < K; ++j) { int L = in() - 1; A[L].push_back(i); } } init(N); for (int i = 0; i < M; ++i) { for (int j = 0; j + 1 < A[i].size(); ++j) { uni(A[i][j], A[i][j + 1]); } } bool ok = true; for (int i = 0; i < N; ++i) { ok &= find(i) == find(0); } puts(ok ? "YES" : "NO"); return 0; }
Submission Info
Submission Time | |
---|---|
Task | C - Interpretation |
User | japlj |
Language | C++14 (GCC 5.4.1) |
Score | 400 |
Code Size | 1681 Byte |
Status | AC |
Exec Time | 30 ms |
Memory | 5372 KB |
Compile Error
./Main.cpp: In function ‘int in()’: ./Main.cpp:34:34: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] int in() { int x; scanf("%d", &x); return x; } ^ ./Main.cpp: In function ‘double fin()’: ./Main.cpp:35:42: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] double fin() { double x; scanf("%lf", &x); return x; } ^ ./Main.cpp: In function ‘Int lin()’: ./Main.cpp:36:37: warning: ignoring return value of ‘int scanf(const char*, ...)’, declared with attribute warn_unused_result [-Wunused-result] Int lin() { Int x; scanf("%lld", &x); return x; } ^
Judge Result
Set Name | sample | dataset1 | dataset2 | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 200 / 200 | 200 / 200 | ||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
sample | sample-01.txt, sample-02.txt |
dataset1 | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt |
dataset2 | sample-01.txt, sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 02-01.txt, 02-02.txt, 02-03.txt, 02-04.txt, 02-05.txt, 02-06.txt, 02-07.txt, 02-08.txt, 02-09.txt, 02-10.txt, 02-11.txt, 02-12.txt, 02-13.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
01-01.txt | AC | 5 ms | 2560 KB |
01-02.txt | AC | 5 ms | 2560 KB |
01-03.txt | AC | 5 ms | 2560 KB |
01-04.txt | AC | 5 ms | 2560 KB |
01-05.txt | AC | 5 ms | 2560 KB |
01-06.txt | AC | 5 ms | 2560 KB |
01-07.txt | AC | 5 ms | 2560 KB |
01-08.txt | AC | 5 ms | 2560 KB |
01-09.txt | AC | 5 ms | 2560 KB |
01-10.txt | AC | 5 ms | 2560 KB |
02-01.txt | AC | 25 ms | 4608 KB |
02-02.txt | AC | 24 ms | 3584 KB |
02-03.txt | AC | 25 ms | 3968 KB |
02-04.txt | AC | 30 ms | 4224 KB |
02-05.txt | AC | 29 ms | 3712 KB |
02-06.txt | AC | 30 ms | 4224 KB |
02-07.txt | AC | 29 ms | 3712 KB |
02-08.txt | AC | 23 ms | 4324 KB |
02-09.txt | AC | 26 ms | 5112 KB |
02-10.txt | AC | 24 ms | 5372 KB |
02-11.txt | AC | 24 ms | 5372 KB |
02-12.txt | AC | 24 ms | 4608 KB |
02-13.txt | AC | 24 ms | 4480 KB |
sample-01.txt | AC | 5 ms | 2560 KB |
sample-02.txt | AC | 5 ms | 2560 KB |