結果

問題 No.679 不思議マーケット
コンテスト
ユーザー kohei2019
提出日時 2022-03-12 01:57:08
言語 PyPy3
(7.3.23 + ACL)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
実行時間 100 ms / 2,000 ms
+ 63µs
コード長 444 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 723 ms
コンパイル使用メモリ 95,728 KB
実行使用メモリ 84,352 KB
最終ジャッジ日時 2026-08-28 13:30:24
合計ジャッジ時間 3,733 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

N,M = map(int,input().split())
ls = [1]*(N)
dic = dict()
for i in range(M):
    a,b = map(int, input().split())
    l = list(map(lambda x :int(x)-1, input().split()))
    a -= 1
    ls[a] = 0
    dic[a] = l

for _ in range(N):
    for i in dic.keys():
        f = True
        for j in dic[i]:
            if ls[j] == 0:
                f = False
                break
        if f:
            ls[i] = 1
            continue
print(ls.count(1))
0