結果

問題 No.2563 色ごとのグループ
ユーザー かもめのうでかもめのうで
提出日時 2023-12-02 16:03:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 511 bytes
コンパイル時間 203 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 145,676 KB
最終ジャッジ日時 2023-12-02 16:03:11
合計ジャッジ時間 7,588 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 33 ms
53,460 KB
testcase_01 AC 32 ms
53,460 KB
testcase_02 AC 32 ms
53,460 KB
testcase_03 AC 32 ms
53,460 KB
testcase_04 AC 31 ms
53,460 KB
testcase_05 AC 31 ms
53,460 KB
testcase_06 AC 32 ms
53,460 KB
testcase_07 AC 31 ms
53,460 KB
testcase_08 AC 31 ms
53,460 KB
testcase_09 AC 34 ms
53,460 KB
testcase_10 AC 32 ms
53,460 KB
testcase_11 AC 35 ms
53,460 KB
testcase_12 AC 32 ms
53,460 KB
testcase_13 AC 32 ms
53,460 KB
testcase_14 AC 59 ms
70,908 KB
testcase_15 AC 61 ms
70,908 KB
testcase_16 AC 60 ms
70,912 KB
testcase_17 AC 58 ms
70,912 KB
testcase_18 AC 42 ms
62,356 KB
testcase_19 AC 63 ms
74,256 KB
testcase_20 AC 84 ms
80,068 KB
testcase_21 AC 73 ms
77,784 KB
testcase_22 AC 72 ms
76,816 KB
testcase_23 AC 77 ms
77,548 KB
testcase_24 AC 176 ms
95,036 KB
testcase_25 AC 164 ms
96,152 KB
testcase_26 AC 209 ms
104,608 KB
testcase_27 AC 222 ms
115,436 KB
testcase_28 AC 247 ms
107,836 KB
testcase_29 AC 297 ms
117,476 KB
testcase_30 AC 301 ms
117,608 KB
testcase_31 AC 290 ms
117,604 KB
testcase_32 AC 325 ms
117,468 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

n, m = map(int, input().split())
c = list(map(int, input().split()))

cnt = [set() for _ in range(n)]
for i in range(n):
    cnt[c[i]-1].add(i)

s = set()
edge = [0]*n
for _ in range(m):
    v, u = map(int, input().split())
    v -= 1
    u -= 1
    if c[v] == c[u]:
        if (v, u) not in s and (u, v) not in s:
            edge[c[v]-1] += 1
            s.add((v, u))
            s.add((u, v))

ans = 0
for e, t in zip(edge, cnt):
    if len(t) == 0:
        continue
    ans += max(len(t)-1-e, 0)
print(ans)
0