結果

問題 No.1730 GCD on Blackboard in yukicoder
ユーザー O2MTO2MT
提出日時 2021-11-07 01:40:14
言語 C#
(.NET 8.0.203)
結果
WA  
実行時間 -
コード長 1,293 bytes
コンパイル時間 9,521 ms
コンパイル使用メモリ 169,924 KB
実行使用メモリ 216,432 KB
最終ジャッジ日時 2024-04-25 14:35:33
合計ジャッジ時間 30,853 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,823 ms
66,688 KB
testcase_01 AC 58 ms
30,592 KB
testcase_02 AC 74 ms
35,948 KB
testcase_03 AC 75 ms
35,700 KB
testcase_04 AC 75 ms
35,812 KB
testcase_05 AC 73 ms
35,828 KB
testcase_06 AC 72 ms
35,704 KB
testcase_07 AC 72 ms
35,688 KB
testcase_08 WA -
testcase_09 AC 71 ms
34,536 KB
testcase_10 WA -
testcase_11 AC 57 ms
30,844 KB
testcase_12 AC 57 ms
30,848 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,644 ms
65,916 KB
testcase_23 AC 679 ms
44,904 KB
testcase_24 AC 709 ms
48,552 KB
testcase_25 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.csproj を復元しました (96 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])
                {
                    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