結果

問題 No.2563 色ごとのグループ
ユーザー raspberry1729
提出日時 2023-12-02 16:01:05
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
WA  
実行時間 -
コード長 477 bytes
コンパイル時間 498 ms
コンパイル使用メモリ 12,416 KB
実行使用メモリ 18,560 KB
最終ジャッジ日時 2024-09-26 19:41:43
合計ジャッジ時間 6,212 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 7 WA * 10 TLE * 1 -- * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

a,b=map(int,input().split())
c=list(map(int,input().split()))
ans=0
zoff=[]
strawberry=[[] for i in range(a)]
very=sorted(set(c))
for _ in very:
	zoff.append(c.count(_))
for _ in zoff:
    asap = [n for n, v in enumerate(c) if v ==_]
    for i in asap:
    	for j in asap:
    		if i==j:
    			continue
    	strawberry[i].append(j)
ans=sum(zoff)-len(zoff)
for i in range(b):
	yaakiyu,kafeore=map(int,input().split())
	if kafeore-1 in strawberry[yaakiyu-1]:
		ans-=1
print(ans)
0