結果

問題 No.2374 ASKT Subsequences
ユーザー 👑 kakel-sankakel-san
提出日時 2023-07-07 22:05:08
言語 C#(csc)
(csc 3.9.0)
結果
WA  
実行時間 -
コード長 1,387 bytes
コンパイル時間 2,126 ms
コンパイル使用メモリ 65,440 KB
実行使用メモリ 59,816 KB
最終ジャッジ日時 2023-09-28 23:23:07
合計ジャッジ時間 6,536 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 63 ms
21,544 KB
testcase_01 AC 62 ms
21,508 KB
testcase_02 AC 63 ms
23,532 KB
testcase_03 AC 62 ms
19,564 KB
testcase_04 AC 63 ms
21,600 KB
testcase_05 AC 61 ms
19,624 KB
testcase_06 AC 64 ms
19,528 KB
testcase_07 AC 63 ms
23,708 KB
testcase_08 AC 63 ms
23,676 KB
testcase_09 AC 68 ms
21,656 KB
testcase_10 AC 67 ms
20,440 KB
testcase_11 AC 79 ms
25,544 KB
testcase_12 WA -
testcase_13 AC 74 ms
21,284 KB
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 AC 93 ms
31,568 KB
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 AC 105 ms
37,296 KB
testcase_26 WA -
testcase_27 AC 149 ms
55,584 KB
testcase_28 WA -
testcase_29 AC 142 ms
55,620 KB
testcase_30 AC 153 ms
55,520 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

using System;
using static System.Console;
using System.Linq;
using System.Collections.Generic;
class Program
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    public static void Main()
    {
        Solve();
    }
    static void Solve()
    {
        var n = NN;
        var a = NList;
        var left = new int[n][];
        var right = new int[n][];
        for (var i = 0; i < n; ++i)
        {
            left[i] = new int[2001];
            right[i] = new int[2001];
        }
        left[0][a[0]] = 1;
        for (var i = 1; i < n; ++i) for (var j = 0; j < left[i].Length; ++j)
        {
            left[i][j] = left[i - 1][j];
            if (j == a[i]) ++left[i][j];
        }
        right[n - 1][a[n - 1]] = 1;
        for (var i = n - 2; i >= 0; --i) for (var j = 0; j < right[i].Length; ++j)
        {
            right[i][j] = right[i + 1][j];
            if (j == a[i]) ++right[i][j];
        }
        var ans = 0L;
        for (var i = 1; i < n; ++i) for (var j = i + 1; j + 1 < n; ++j)
        {
            if (a[i] < a[j]) continue;
            var a1 = a[j] - 10;
            var a4 = a[i] + 1;
            if (a1 < 0 || a4 > 2000) continue;
            ans += left[i - 1][a1] * right[j + 1][a4];
        }
        WriteLine(ans);
    }
}
0