結果
問題 |
No.1390 Get together
|
ユーザー |
![]() |
提出日時 | 2021-02-13 16:36:28 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 675 bytes |
コンパイル時間 | 2,599 ms |
コンパイル使用メモリ | 77,048 KB |
実行使用メモリ | 111,116 KB |
最終ジャッジ日時 | 2024-07-20 19:40:40 |
合計ジャッジ時間 | 37,801 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 15 WA * 12 TLE * 2 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(); int m = sc.nextInt(); HashMap<Integer, HashSet<Integer>> counts = new HashMap<>(); for (int i = 0; i < n; i++) { int b = sc.nextInt(); int c = sc.nextInt(); if (!counts.containsKey(c)) { counts.put(c, new HashSet<>()); } counts.get(c).add(b); } int ans = 0; for (HashSet<Integer> set : counts.values()) { ans += set.size() - 1; } System.out.println(ans); } }