結果

問題 No.2563 色ごとのグループ
ユーザー raspberry1729
提出日時 2023-12-02 16:00:36
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 430 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 12,672 KB
実行使用メモリ 20,252 KB
最終ジャッジ日時 2024-09-26 19:40:56
合計ジャッジ時間 6,057 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 17 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 i in range(a-1):
	for j in range(i+1,a):
		if c[i]==c[j]:
			strawberry[i].append(j)
			strawberry[j].append(i)
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