結果
問題 |
No.679 不思議マーケット
|
ユーザー |
![]() |
提出日時 | 2018-08-13 12:22:35 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 494 bytes |
コンパイル時間 | 258 ms |
コンパイル使用メモリ | 12,544 KB |
実行使用メモリ | 17,820 KB |
最終ジャッジ日時 | 2024-09-24 07:51:52 |
合計ジャッジ時間 | 3,973 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 3 TLE * 1 -- * 14 |
ソースコード
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 or not search(j,x): 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)