結果
問題 | No.2563 色ごとのグループ |
ユーザー | YuuuT |
提出日時 | 2023-12-02 15:02:08 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 789 bytes |
コンパイル時間 | 225 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 114,436 KB |
最終ジャッジ日時 | 2023-12-02 15:02:18 |
合計ジャッジ時間 | 5,206 ms |
ジャッジサーバーID (参考情報) |
judge9 / judge14 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 38 ms
55,628 KB |
testcase_01 | AC | 40 ms
55,628 KB |
testcase_02 | AC | 40 ms
55,628 KB |
testcase_03 | AC | 38 ms
55,628 KB |
testcase_04 | AC | 40 ms
55,628 KB |
testcase_05 | AC | 40 ms
55,628 KB |
testcase_06 | AC | 39 ms
55,628 KB |
testcase_07 | AC | 38 ms
55,628 KB |
testcase_08 | AC | 37 ms
55,628 KB |
testcase_09 | AC | 39 ms
55,628 KB |
testcase_10 | AC | 38 ms
55,628 KB |
testcase_11 | AC | 47 ms
55,628 KB |
testcase_12 | AC | 39 ms
55,628 KB |
testcase_13 | AC | 39 ms
55,628 KB |
testcase_14 | AC | 51 ms
66,756 KB |
testcase_15 | AC | 50 ms
66,884 KB |
testcase_16 | AC | 49 ms
66,764 KB |
testcase_17 | AC | 52 ms
66,768 KB |
testcase_18 | AC | 47 ms
64,576 KB |
testcase_19 | AC | 51 ms
71,020 KB |
testcase_20 | AC | 64 ms
78,408 KB |
testcase_21 | AC | 58 ms
74,228 KB |
testcase_22 | AC | 56 ms
73,076 KB |
testcase_23 | AC | 64 ms
76,924 KB |
testcase_24 | AC | 130 ms
98,264 KB |
testcase_25 | AC | 123 ms
99,748 KB |
testcase_26 | AC | 180 ms
102,504 KB |
testcase_27 | AC | 170 ms
113,536 KB |
testcase_28 | AC | 172 ms
105,116 KB |
testcase_29 | AC | 214 ms
114,272 KB |
testcase_30 | AC | 210 ms
114,436 KB |
testcase_31 | AC | 209 ms
114,280 KB |
testcase_32 | AC | 235 ms
114,368 KB |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | WA | - |
ソースコード
import sys,math #if len(sys.argv)==2:sys.stdin=open(sys.argv[1]) from collections import defaultdict,deque from itertools import combinations,permutations,accumulate,product from bisect import bisect,bisect_left,bisect_right from heapq import heappop,heappush,heapify #from sortedcontainers import SortedList,SortedSet def input(): return sys.stdin.readline().rstrip() def ii(): return int(input()) def ms(): return map(int, input().split()) def li(): return list(map(int,input().split())) #//////////////////////////////////// N,M = ms() C = li() ans = 0 gro = defaultdict(list) for i in range(N): gro[C[i]].append(i+1) cnt = defaultdict(int) for _ in range(M): u,v = ms() if C[u-1]==C[v-1]: cnt[C[u-1]] += 1 for c in gro.keys(): ans += max(len(gro[c])-cnt[c]-1,0) print(ans)