結果

問題 No.2329 Nafmo、イカサマをする
ユーザー 👑 kakel-sankakel-san
提出日時 2023-10-16 20:44:23
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,104 bytes
コンパイル時間 3,001 ms
コンパイル使用メモリ 68,096 KB
実行使用メモリ 37,028 KB
最終ジャッジ日時 2023-10-16 20:44:33
合計ジャッジ時間 9,855 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
24,904 KB
testcase_01 AC 67 ms
22,836 KB
testcase_02 AC 66 ms
20,764 KB
testcase_03 WA -
testcase_04 AC 67 ms
22,728 KB
testcase_05 AC 66 ms
22,812 KB
testcase_06 AC 67 ms
22,856 KB
testcase_07 AC 66 ms
22,740 KB
testcase_08 AC 68 ms
24,828 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 AC 66 ms
20,808 KB
testcase_17 WA -
testcase_18 AC 71 ms
24,748 KB
testcase_19 WA -
testcase_20 AC 74 ms
24,908 KB
testcase_21 AC 95 ms
24,872 KB
testcase_22 AC 69 ms
24,896 KB
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 73 ms
23,096 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 67 ms
22,836 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 118 ms
27,832 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 176 ms
33,824 KB
testcase_42 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;

class Program
{
    static int NN => int.Parse(ReadLine());
    static long[] NList => ReadLine().Split().Select(long.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var c = NList;
        var (n, m, k) = (c[0], c[1], c[2]);
        var a = NList;
        var set = new HashSet<long>();
        for (var i = 0; i <= n; ++i) for (var j = 0; j <= n; ++j) for (var p = 0; p <= n; ++p)
        {
            var ai = i == n ? 0 : a[i];
            var aj = j == n ? 0 : a[j];
            var ap = p == n ? 0 : a[p];
            set.Add(ai + aj + ap);
        }
        var list = new List<long>(set);
        list.Sort();
        var pos = list.Count - 1;
        var ans = 0L;
        for (var i = 0; i < list.Count; ++i)
        {
            while (pos >= 0 && list[i] + list[pos] > m) --pos;
            if (pos >= 0) ans = Math.Max(ans, list[i] + list[pos]);
        }
        WriteLine(ans);
    }
}
0