結果
問題 |
No.679 不思議マーケット
|
ユーザー |
![]() |
提出日時 | 2018-08-13 15:56:40 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 38 ms / 2,000 ms |
コード長 | 481 bytes |
コンパイル時間 | 194 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,136 KB |
最終ジャッジ日時 | 2024-09-24 08:02:59 |
合計ジャッジ時間 | 1,346 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 18 |
ソースコード
n,m = map(int,input().split()) goods = [[]for i in range(n+1)] def search(i): if goods[i]==-1:return False if goods[i]!=[]: tmp = goods[i][:] goods[i] = -1 for j in tmp: if search(j):goods[j]=[] else:return False goods[i] = [] return True for i in range(m): g,r = map(int,input().split()) goods[g] = list(map(int,input().split())) cnt = 0 for i in range(1,n+1): if not search(i):cnt+=1 print(n-cnt)