Submission #37383765
Source Code Expand
import sys
import numpy as np
# 入力
N, M = map(int, input().split())
# X[i][j] = (i回目の舞踏会に人jが参加したならTrue, そうでないならFalse) M×N行列
X = np.zeros(shape=(M, N), dtype='?')
for i, line in enumerate(sys.stdin.readlines()):
x = np.fromstring(line, sep=' ', dtype=int)[1:]
X[i][x - 1] = True
# Y[i][j] = (人iと人jが少なくとも1回同じ舞踏会に参加していればTrue, そうでないならFalse) N×N行列
Y = X.T @ X
# Yの要素が全てTrueならYes, そうでないならNo
print('Yes' if Y.all() else 'No')
Submission Info
| Submission Time | |
|---|---|
| Task | B - Everyone is Friends |
| User | math_hiyoko |
| Language | Python (3.8.2) |
| Score | 200 |
| Code Size | 592 Byte |
| Status | AC |
| Exec Time | 106 ms |
| Memory | 26988 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 200 / 200 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00_sample_01.txt, 00_sample_02.txt |
| All | 00_sample_01.txt, 00_sample_02.txt, 01_test_01.txt, 01_test_02.txt, 01_test_03.txt, 01_test_04.txt, 01_test_05.txt, 01_test_06.txt, 01_test_07.txt, 01_test_08.txt, 01_test_09.txt, 01_test_10.txt, 01_test_11.txt, 01_test_12.txt, 01_test_13.txt, 01_test_14.txt, 01_test_15.txt, 01_test_16.txt, 01_test_17.txt, 01_test_18.txt, 02_handmade_01.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00_sample_01.txt | AC | 104 ms | 26352 KiB |
| 00_sample_02.txt | AC | 98 ms | 26672 KiB |
| 01_test_01.txt | AC | 99 ms | 26348 KiB |
| 01_test_02.txt | AC | 102 ms | 26796 KiB |
| 01_test_03.txt | AC | 103 ms | 26752 KiB |
| 01_test_04.txt | AC | 100 ms | 26880 KiB |
| 01_test_05.txt | AC | 103 ms | 26896 KiB |
| 01_test_06.txt | AC | 102 ms | 26624 KiB |
| 01_test_07.txt | AC | 102 ms | 26988 KiB |
| 01_test_08.txt | AC | 102 ms | 26680 KiB |
| 01_test_09.txt | AC | 100 ms | 26864 KiB |
| 01_test_10.txt | AC | 99 ms | 26552 KiB |
| 01_test_11.txt | AC | 100 ms | 26788 KiB |
| 01_test_12.txt | AC | 102 ms | 26512 KiB |
| 01_test_13.txt | AC | 101 ms | 26672 KiB |
| 01_test_14.txt | AC | 101 ms | 26664 KiB |
| 01_test_15.txt | AC | 100 ms | 26524 KiB |
| 01_test_16.txt | AC | 101 ms | 26804 KiB |
| 01_test_17.txt | AC | 106 ms | 26588 KiB |
| 01_test_18.txt | AC | 101 ms | 26736 KiB |
| 02_handmade_01.txt | AC | 103 ms | 26720 KiB |