結果
問題 |
No.2563 色ごとのグループ
|
ユーザー |
|
提出日時 | 2023-12-02 15:38:39 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 430 bytes |
コンパイル時間 | 1,266 ms |
コンパイル使用メモリ | 12,288 KB |
実行使用メモリ | 19,872 KB |
最終ジャッジ日時 | 2024-09-26 19:03:52 |
合計ジャッジ時間 | 7,157 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 17 TLE * 1 -- * 17 |
ソースコード
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)