結果
| 問題 | 
                            No.1390 Get together
                             | 
                    
| コンテスト | |
| ユーザー | 
                             学ぶマン
                         | 
                    
| 提出日時 | 2025-09-01 18:15:52 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                WA
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 674 bytes | 
| コンパイル時間 | 490 ms | 
| コンパイル使用メモリ | 82,740 KB | 
| 実行使用メモリ | 120,736 KB | 
| 最終ジャッジ日時 | 2025-09-01 18:16:03 | 
| 合計ジャッジ時間 | 11,092 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 14 WA * 15 | 
ソースコード
import sys, math
sys.setrecursionlimit(10**8)
sys.set_int_max_str_digits(0)
INF = 10**18
MOD = 998244353
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter
from itertools import product, combinations, permutations, groupby, accumulate
from heapq import heapify, heappop, heappush
N, M = map(int, input().split())
data = defaultdict(list)
for i in range(N):
    b, c = map(int, input().split())
    data[c].append(b)
ans = 0
for k, v in data.items():
    most_common_box_for_this_color = Counter(v).most_common()[0][1]
    #print(k, most_common_box_for_this_color)
    ans += len(v) - most_common_box_for_this_color
print(ans)
            
            
            
        
            
学ぶマン