結果
| 問題 |
No.693 square1001 and Permutation 2
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-01-29 11:37:02 |
| 言語 | C# (.NET 8.0.404) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 966 bytes |
| コンパイル時間 | 7,736 ms |
| コンパイル使用メモリ | 169,740 KB |
| 実行使用メモリ | 62,252 KB |
| 最終ジャッジ日時 | 2025-01-29 11:37:15 |
| 合計ジャッジ時間 | 11,989 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 6 WA * 2 TLE * 1 |
コンパイルメッセージ
復元対象のプロジェクトを決定しています... /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/
ソースコード
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++)
{
total++;
if (count[j] == 0)
{
count[j] = 1;
count[i]--;
break;
}
}
}
Console.WriteLine(total);
}
}
}