Submission #2525365
Source Code Expand
import java.util.*; import java.util.Map.Entry; public class Main { public static void main(String[] args){ Scanner sc = new Scanner(System.in); int n = sc.nextInt(); HashMap<Integer, Integer> m = new HashMap<>(); for(int i = 0; i < n; i++) { int a = sc.nextInt(); m.put(a, m.containsKey(a) ? m.get(a) + 1 : 1); } int s = 0; for(Entry<Integer, Integer> e : m.entrySet()) { int k = e.getKey(); int v = e.getValue(); if(k <= v) { s += v - k; } else { s += v; } } System.out.println(s); } }
Submission Info
Submission Time | |
---|---|
Task | C - Good Sequence |
User | nkhrlab |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 745 Byte |
Status | AC |
Exec Time | 516 ms |
Memory | 63172 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 0_04.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt, 1_10.txt, 1_11.txt, 1_12.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 93 ms | 18644 KB |
0_01.txt | AC | 93 ms | 18516 KB |
0_02.txt | AC | 93 ms | 18900 KB |
0_03.txt | AC | 94 ms | 19152 KB |
0_04.txt | AC | 93 ms | 21076 KB |
1_00.txt | AC | 93 ms | 20052 KB |
1_01.txt | AC | 93 ms | 18772 KB |
1_02.txt | AC | 413 ms | 45432 KB |
1_03.txt | AC | 423 ms | 49288 KB |
1_04.txt | AC | 470 ms | 46452 KB |
1_05.txt | AC | 452 ms | 48192 KB |
1_06.txt | AC | 505 ms | 46732 KB |
1_07.txt | AC | 477 ms | 49996 KB |
1_08.txt | AC | 480 ms | 46532 KB |
1_09.txt | AC | 481 ms | 52312 KB |
1_10.txt | AC | 508 ms | 49224 KB |
1_11.txt | AC | 501 ms | 63172 KB |
1_12.txt | AC | 516 ms | 61796 KB |