結果
問題 |
No.679 不思議マーケット
|
ユーザー |
![]() |
提出日時 | 2018-08-13 12:31:52 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
RE
|
実行時間 | - |
コード長 | 566 bytes |
コンパイル時間 | 204 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 11,392 KB |
最終ジャッジ日時 | 2024-09-24 07:57:09 |
合計ジャッジ時間 | 1,529 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 8 RE * 10 |
ソースコード
n,m = map(int,input().split()) goods = [[]for i in range(n+1)] def search(i,x): if goods[i]==-1: return False else: for j in goods[i]: if j==x:return if search(j,x):goods[j]=[] else: goods[j]=-1 return False return True for i in range(m): g,r = map(int,input().split()) h = list(map(int,input().split())) goods[g] = h cnt = 0 for i in range(1,n+1): if search(i,i): goods[i] = [] else: goods[i] = -1 cnt+=1 print(n-cnt)