結果

問題 No.1623 三角形の制作
ユーザー 👑 kakel-sankakel-san
提出日時 2021-07-23 21:44:20
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 286 ms / 2,000 ms
コード長 987 bytes
コンパイル時間 1,781 ms
コンパイル使用メモリ 65,924 KB
実行使用メモリ 53,408 KB
最終ジャッジ日時 2023-09-25 21:38:02
合計ジャッジ時間 6,862 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 60 ms
21,636 KB
testcase_01 AC 60 ms
21,628 KB
testcase_02 AC 205 ms
50,508 KB
testcase_03 AC 201 ms
49,380 KB
testcase_04 AC 198 ms
49,216 KB
testcase_05 AC 286 ms
50,952 KB
testcase_06 AC 111 ms
28,128 KB
testcase_07 AC 201 ms
45,308 KB
testcase_08 AC 115 ms
28,740 KB
testcase_09 AC 194 ms
46,036 KB
testcase_10 AC 250 ms
47,792 KB
testcase_11 AC 218 ms
52,328 KB
testcase_12 AC 128 ms
38,716 KB
testcase_13 AC 141 ms
40,068 KB
testcase_14 AC 137 ms
37,668 KB
testcase_15 AC 250 ms
50,716 KB
testcase_16 AC 250 ms
50,844 KB
testcase_17 AC 254 ms
52,848 KB
testcase_18 AC 267 ms
53,408 KB
testcase_19 AC 163 ms
44,388 KB
testcase_20 AC 61 ms
23,660 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

class yuki
{
    static int NN => int.Parse(ReadLine());
    static int[] NList => ReadLine().Split().Select(int.Parse).ToArray();
    static void Main()
    {
        var n = NN;
        var r = NList;
        var g = NList;
        var b = NList;
        
        var red = new int[3001];
        var gre = new int[3001];
        var blu = new int[3001];
        foreach (var ri in r) ++red[ri];
        foreach (var gi in g) ++gre[gi];
        foreach (var bi in b) ++blu[bi];
        for (var i = 1; i < blu.Length; ++i)
        {
            blu[i] += blu[i - 1];
        }

        var res = 0L;
        for (var ri = 0; ri < red.Length; ++ri)
        {
            if (red[ri] == 0) continue;
            for (var gi = 1; gi <= ri; ++gi)
            {
                res += (long)red[ri] * gre[gi] * (blu[ri] - blu[ri - gi]);
            }
        }
        WriteLine(res);
    }
}
0