結果

問題 No.679 不思議マーケット
ユーザー kohei2019kohei2019
提出日時 2022-03-12 01:57:08
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 144 ms / 2,000 ms
コード長 444 bytes
コンパイル時間 1,362 ms
コンパイル使用メモリ 87,236 KB
実行使用メモリ 77,108 KB
最終ジャッジ日時 2023-10-14 11:11:43
合計ジャッジ時間 4,569 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 73 ms
71,220 KB
testcase_01 AC 72 ms
71,116 KB
testcase_02 AC 72 ms
71,044 KB
testcase_03 AC 144 ms
76,996 KB
testcase_04 AC 107 ms
76,336 KB
testcase_05 AC 110 ms
77,108 KB
testcase_06 AC 105 ms
76,536 KB
testcase_07 AC 95 ms
75,860 KB
testcase_08 AC 108 ms
76,356 KB
testcase_09 AC 73 ms
71,184 KB
testcase_10 AC 102 ms
76,092 KB
testcase_11 AC 100 ms
76,028 KB
testcase_12 AC 104 ms
76,416 KB
testcase_13 AC 108 ms
76,584 KB
testcase_14 AC 104 ms
76,180 KB
testcase_15 AC 96 ms
75,992 KB
testcase_16 AC 72 ms
71,180 KB
testcase_17 AC 73 ms
71,152 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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