結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー O2MTO2MT
提出日時 2021-11-07 01:34:05
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,310 bytes
コンパイル時間 9,788 ms
コンパイル使用メモリ 168,988 KB
実行使用メモリ 216,920 KB
最終ジャッジ日時 2024-04-25 14:18:21
合計ジャッジ時間 28,222 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,907 ms
66,668 KB
testcase_01 AC 55 ms
30,720 KB
testcase_02 AC 70 ms
35,928 KB
testcase_03 AC 71 ms
35,704 KB
testcase_04 AC 70 ms
35,816 KB
testcase_05 AC 71 ms
35,828 KB
testcase_06 AC 69 ms
35,704 KB
testcase_07 AC 69 ms
36,084 KB
testcase_08 WA -
testcase_09 AC 69 ms
34,804 KB
testcase_10 WA -
testcase_11 AC 56 ms
30,336 KB
testcase_12 AC 54 ms
30,844 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 1,740 ms
65,796 KB
testcase_23 AC 683 ms
44,644 KB
testcase_24 WA -
testcase_25 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (97 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/

ソースコード

diff #

using System;
using System.Linq;

namespace Sample
{
    class Program
    {
        static void Main(string[] args)
        {
            var N = int.Parse(Console.ReadLine());
            var A = Console.ReadLine().Split(' ')
                .Select(x => int.Parse(x)).ToArray();
            var MAX_A = A.Max();
            var K = new int[N];
            for (int i = 0; i < N; i++)
            {
                K[i] = 1;
            }
            var divs = new int[MAX_A + 1];
            for (int i = 0; i <= MAX_A; i++)
            {
                divs[i] = 0;
            }
            foreach (var a in A)
            {
                for (int i = 1; i <= Math.Sqrt(a); i++)
                {
                    if (a % i == 0)
                    {
                        divs[i]++;
                        divs[a / i]++;
                    }
                }
            }
            for (int i = 0; i <= MAX_A; i++)
            {
                if (0 < divs[i] && divs[i] <= N)
                {
                    K[N - divs[i]] = Math.Max(K[N - divs[i]], i);
                }
            }
            var now = 1;
            for (int i = 0; i < N; i++)
            {
                now = Math.Max(now, K[i]);
                Console.WriteLine(now);
            }
        }
    }
}
0