提出 #37383765
ソースコード 拡げる
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')
提出情報
| 提出日時 | |
|---|---|
| 問題 | B - Everyone is Friends |
| ユーザ | math_hiyoko |
| 言語 | Python (3.8.2) |
| 得点 | 200 |
| コード長 | 592 Byte |
| 結果 | AC |
| 実行時間 | 106 ms |
| メモリ | 26988 KiB |
ジャッジ結果
| セット名 | Sample | All | ||||
|---|---|---|---|---|---|---|
| 得点 / 配点 | 0 / 0 | 200 / 200 | ||||
| 結果 |
|
|
| セット名 | テストケース |
|---|---|
| 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 |
| ケース名 | 結果 | 実行時間 | メモリ |
|---|---|---|---|
| 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 |