結果

問題 No.800 四平方定理
ユーザー keymoonkeymoon
提出日時 2019-03-28 21:26:46
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 489 ms / 2,000 ms
コード長 901 bytes
コンパイル時間 2,099 ms
コンパイル使用メモリ 106,760 KB
実行使用メモリ 42,668 KB
最終ジャッジ日時 2023-08-04 17:02:45
合計ジャッジ時間 10,591 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
21,708 KB
testcase_01 AC 67 ms
21,912 KB
testcase_02 AC 66 ms
21,912 KB
testcase_03 AC 65 ms
21,868 KB
testcase_04 AC 65 ms
21,932 KB
testcase_05 AC 67 ms
21,856 KB
testcase_06 AC 68 ms
23,744 KB
testcase_07 AC 67 ms
19,772 KB
testcase_08 AC 69 ms
23,968 KB
testcase_09 AC 68 ms
21,780 KB
testcase_10 AC 232 ms
32,708 KB
testcase_11 AC 222 ms
30,784 KB
testcase_12 AC 228 ms
31,872 KB
testcase_13 AC 207 ms
31,360 KB
testcase_14 AC 234 ms
29,872 KB
testcase_15 AC 258 ms
29,776 KB
testcase_16 AC 221 ms
29,960 KB
testcase_17 AC 220 ms
29,884 KB
testcase_18 AC 254 ms
33,960 KB
testcase_19 AC 272 ms
31,796 KB
testcase_20 AC 62 ms
21,648 KB
testcase_21 AC 63 ms
21,800 KB
testcase_22 AC 263 ms
33,776 KB
testcase_23 AC 476 ms
42,668 KB
testcase_24 AC 415 ms
36,924 KB
testcase_25 AC 489 ms
40,572 KB
testcase_26 AC 65 ms
21,792 KB
testcase_27 AC 64 ms
23,820 KB
testcase_28 AC 408 ms
36,920 KB
testcase_29 AC 451 ms
38,616 KB
testcase_30 AC 426 ms
36,780 KB
testcase_31 AC 396 ms
37,684 KB
testcase_32 AC 432 ms
37,380 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.IO;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using System.Numerics;
using System.Threading.Tasks;
using System.Text.RegularExpressions;
using static System.Math;
using Debug = System.Diagnostics.Debug;
using LayoutKind = System.Runtime.InteropServices.LayoutKind;

static class P
{
    static void Main()
    {
        var nd = Console.ReadLine().Split().Select(int.Parse).ToArray();
        int[] pows = Enumerable.Range(1, nd[0]).Select(x => x * x).ToArray();
        var dict = pows.SelectMany(x => pows.Select(y => x - y + nd[1])).Aggregate(new int[nd[0] * nd[0] + Max(nd[1], nd[0] * nd[0] + 1)], (x, y) => {
                if (y <= 0) return x;
                x[y]++;
                return x;
            });
        Console.WriteLine(pows.SelectMany(x => pows.Select(y => x + y)).Sum(x => dict[x]));
    }
}
0