結果
問題 |
No.2334 Distinct Cards
|
ユーザー |
![]() |
提出日時 | 2023-06-28 21:27:14 |
言語 | C# (.NET 8.0.404) |
結果 |
AC
|
実行時間 | 76 ms / 2,000 ms |
コード長 | 811 bytes |
コンパイル時間 | 13,490 ms |
コンパイル使用メモリ | 166,324 KB |
実行使用メモリ | 182,324 KB |
最終ジャッジ日時 | 2024-07-05 14:56:34 |
合計ジャッジ時間 | 16,399 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (90 ms)。 MSBuild のバージョン 17.9.6+a4ecab324 (.NET) main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System; namespace No02334_DistinctCards { internal class Program { static void Main(string[] args) { string[] param = Console.ReadLine().Split(' '); int n = int.Parse(param[0]); int k = int.Parse(param[1]); int[] array = Array.ConvertAll(Console.ReadLine().Split(' '), x => int.Parse(x)); int[] countArray = new int[n]; for(int i = 0; i < n; i++) { countArray[array[i] - 1]++; } Array.Sort(countArray); int total = 0; for (int i = n - 1; 0 <= i; i--) { total += countArray[i]; if(k <= total) { Console.WriteLine(n - i); return; } } } } }