結果
問題 | No.2563 色ごとのグループ |
ユーザー | YuuuT |
提出日時 | 2023-12-02 15:00:18 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 782 bytes |
コンパイル時間 | 228 ms |
コンパイル使用メモリ | 81,700 KB |
実行使用メモリ | 114,364 KB |
最終ジャッジ日時 | 2023-12-02 15:00:24 |
合計ジャッジ時間 | 5,871 ms |
ジャッジサーバーID (参考情報) |
judge9 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
55,628 KB |
testcase_01 | AC | 44 ms
55,628 KB |
testcase_02 | AC | 45 ms
55,628 KB |
testcase_03 | AC | 46 ms
55,628 KB |
testcase_04 | AC | 46 ms
55,628 KB |
testcase_05 | AC | 44 ms
55,628 KB |
testcase_06 | AC | 45 ms
55,628 KB |
testcase_07 | AC | 44 ms
55,628 KB |
testcase_08 | AC | 46 ms
55,628 KB |
testcase_09 | AC | 45 ms
55,628 KB |
testcase_10 | AC | 45 ms
55,628 KB |
testcase_11 | AC | 47 ms
55,628 KB |
testcase_12 | AC | 46 ms
55,628 KB |
testcase_13 | AC | 45 ms
55,628 KB |
testcase_14 | AC | 60 ms
66,756 KB |
testcase_15 | AC | 60 ms
66,884 KB |
testcase_16 | AC | 58 ms
66,764 KB |
testcase_17 | AC | 59 ms
66,768 KB |
testcase_18 | AC | 55 ms
64,576 KB |
testcase_19 | AC | 62 ms
71,020 KB |
testcase_20 | AC | 78 ms
78,416 KB |
testcase_21 | AC | 68 ms
73,972 KB |
testcase_22 | AC | 65 ms
73,076 KB |
testcase_23 | AC | 75 ms
76,924 KB |
testcase_24 | AC | 146 ms
98,264 KB |
testcase_25 | AC | 145 ms
99,792 KB |
testcase_26 | AC | 186 ms
102,508 KB |
testcase_27 | AC | 200 ms
113,404 KB |
testcase_28 | AC | 202 ms
105,116 KB |
testcase_29 | AC | 250 ms
114,280 KB |
testcase_30 | AC | 247 ms
114,280 KB |
testcase_31 | AC | 255 ms
114,248 KB |
testcase_32 | AC | 247 ms
114,364 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 += len(gro[c])-cnt[c]-1 print(ans)