結果
問題 |
No.693 square1001 and Permutation 2
|
ユーザー |
|
提出日時 | 2025-01-29 11:36:24 |
言語 | C# (.NET 8.0.404) |
結果 |
WA
|
実行時間 | - |
コード長 | 966 bytes |
コンパイル時間 | 9,261 ms |
コンパイル使用メモリ | 171,660 KB |
実行使用メモリ | 190,356 KB |
最終ジャッジ日時 | 2025-01-29 11:36:36 |
合計ジャッジ時間 | 9,928 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 5 WA * 2 RE * 2 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /home/judge/data/code/main.csproj を復元しました (113 ミリ秒)。 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 = 20; 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++) { total++; if (count[j] == 0) { count[j] = 1; count[i]--; break; } } } Console.WriteLine(total); } } }