結果

問題 No.1380 Borderline
ユーザー Maeda
提出日時 2025-04-08 15:27:55
言語 C#
(.NET 8.0.404)
結果
AC  
実行時間 56 ms / 2,000 ms
コード長 1,118 bytes
コンパイル時間 7,926 ms
コンパイル使用メモリ 169,588 KB
実行使用メモリ 187,432 KB
最終ジャッジ日時 2025-04-08 15:28:08
合計ジャッジ時間 12,141 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 41
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (110 ミリ秒)。
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

   class Program
   {
       static void Main(string[] args)
       {
           string[] nk = Console.ReadLine().Split(' ');
           string[] scoreStr = Console.ReadLine().Split(' ');
           List<int> scoreNum = new List<int>();
           int[] scoreList = new int[401];
           for (int i = 0; i < int.Parse(nk[0]); i++)
           {
               scoreList[int.Parse(scoreStr[i])]++;
               scoreNum.Add(int.Parse(scoreStr[i]));
           }
           scoreNum.Sort();
           int capacity = int.Parse(nk[1]);
           int borderScore = scoreNum[int.Parse(nk[0])-capacity];
           int count = 0;
           Array.Reverse(scoreList);
           for (int i = 0; i < 401; i++)
           {
               if (scoreList[i] == 0)
               {
                   continue;
               }
               if(count + scoreList[i] <= capacity && borderScore <= 400 - i)
               {
                   count += scoreList[i];
               }
               else
               {
                   break;
               }
           }
           Console.WriteLine(count);
       }
   }
0