結果

問題 No.679 不思議マーケット
ユーザー H3PO4H3PO4
提出日時 2020-11-22 08:41:17
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 39 ms / 2,000 ms
コード長 506 bytes
コンパイル時間 69 ms
コンパイル使用メモリ 10,780 KB
実行使用メモリ 9,360 KB
最終ジャッジ日時 2023-09-30 22:31:30
合計ジャッジ時間 1,348 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 15 ms
7,816 KB
testcase_01 AC 16 ms
7,812 KB
testcase_02 AC 16 ms
7,756 KB
testcase_03 AC 39 ms
9,360 KB
testcase_04 AC 21 ms
8,644 KB
testcase_05 AC 23 ms
8,532 KB
testcase_06 AC 20 ms
8,212 KB
testcase_07 AC 18 ms
8,268 KB
testcase_08 AC 21 ms
8,732 KB
testcase_09 AC 16 ms
7,928 KB
testcase_10 AC 18 ms
8,216 KB
testcase_11 AC 19 ms
8,316 KB
testcase_12 AC 20 ms
8,420 KB
testcase_13 AC 20 ms
8,208 KB
testcase_14 AC 20 ms
8,252 KB
testcase_15 AC 18 ms
8,400 KB
testcase_16 AC 15 ms
7,780 KB
testcase_17 AC 15 ms
7,880 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

int1 = lambda x: int(x) - 1

N, M = map(int, input().split())
table = [None] * N
for _ in range(M):
    g, r = map(int, input().split())
    h = set(map(int1, input().split()))
    g -= 1
    table[g] = h

basket = set(i for i, t in enumerate(table) if t is None)
ans = len(basket)
while True:
    for i in range(N):
        if i not in basket:
            if table[i] <= basket:
                basket.add(i)
    if ans == len(basket):
        print(ans)
        break
    else:
        ans = len(basket)
0