結果
問題 |
No.693 square1001 and Permutation 2
|
ユーザー |
|
提出日時 | 2025-01-29 11:32:25 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 926 bytes |
コンパイル時間 | 11,069 ms |
コンパイル使用メモリ | 169,304 KB |
実行使用メモリ | 62,516 KB |
最終ジャッジ日時 | 2025-01-29 11:32:49 |
合計ジャッジ時間 | 15,452 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 1 WA * 1 |
other | AC * 4 WA * 4 TLE * 1 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (117 ミリ秒)。 main -> /home/judge/data/code/bin/Release/net8.0/main.dll main -> /home/judge/data/code/bin/Release/net8.0/publish/
ソースコード
using System.IO; namespace ttt { internal class Program { static void Main(string[] args) { int max = 50; int n = int.Parse(Console.ReadLine()); string input = Console.ReadLine(); int[] nums = input.Split(' ').Select(int.Parse).ToArray(); int[] count = new int[max + 1]; int total = 0; foreach (int i in nums) count[i]++; for (int i = max; i > 0; i--) while (count[i] > 1) { for (int j = i + 1; j <= max; j++) if (count[j] == 0) { count[j] = 1; count[i]--; total++; break; } } Console.WriteLine(total); } } }