Submission #2710650
Source Code Expand
using System; using System.Collections.Generic; using System.Linq; using System.Web; namespace Competitive { internal class Solution { public int N, K; public int[] A; public void Run() { { var line = Input.ReadIntArray(); N = line[0]; K = line[1]; A = Input.ReadIntArray(); } Dictionary<int, int> count = new Dictionary<int, int>(); for (int i = 0; i < N; i++) { if(!count.ContainsKey(A[i])) count.Add(A[i], 0); count[A[i]]++; } List<int> c = new List<int>(); foreach (var kv in count) { c.Add(kv.Value); } c.Sort(); int ret = 0; for (int i = 0; i < c.Count - K; i++) ret += c[i]; Console.WriteLine(ret); } } // libs ---------- // common ---------- internal static class Input { public static string ReadString() { string line = Console.ReadLine(); return line; } public static int ReadInt() { string line = Console.ReadLine(); return int.Parse(line); } public static int[] ReadIntArray() { string line = Console.ReadLine(); return line.Split(' ').Select(int.Parse).ToArray(); } public static long ReadLong() { string line = Console.ReadLine(); return long.Parse(line); } public static long[] ReadLongArray() { string line = Console.ReadLine(); return line.Split(' ').Select(long.Parse).ToArray(); } public static double[] ReadDoubleArray() { string line = Console.ReadLine(); return line.Split(' ').Select(double.Parse).ToArray(); } } internal class Program { public static void Main(string[] args) { var s = new Solution(); s.Run(); } } }
Submission Info
Submission Time | |
---|---|
Task | C - Not so Diverse |
User | threecourse |
Language | C# (Mono 4.6.2.0) |
Score | 300 |
Code Size | 2255 Byte |
Status | AC |
Exec Time | 158 ms |
Memory | 41796 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, 1.txt, 10.txt, 11.txt, 12.txt, 13.txt, 2.txt, 3.txt, 4.txt, 5.txt, 6.txt, 7.txt, 8.txt, 9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
1.txt | AC | 34 ms | 13908 KB |
10.txt | AC | 120 ms | 29916 KB |
11.txt | AC | 123 ms | 31708 KB |
12.txt | AC | 158 ms | 41796 KB |
13.txt | AC | 116 ms | 34268 KB |
2.txt | AC | 25 ms | 9184 KB |
3.txt | AC | 123 ms | 33628 KB |
4.txt | AC | 122 ms | 33756 KB |
5.txt | AC | 119 ms | 29916 KB |
6.txt | AC | 114 ms | 31964 KB |
7.txt | AC | 107 ms | 29532 KB |
8.txt | AC | 112 ms | 33756 KB |
9.txt | AC | 125 ms | 31452 KB |
sample1.txt | AC | 26 ms | 13268 KB |
sample2.txt | AC | 25 ms | 11232 KB |
sample3.txt | AC | 26 ms | 11232 KB |