結果

問題 No.1623 三角形の制作
ユーザー dangodango
提出日時 2023-07-15 19:21:02
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 302 ms / 2,000 ms
コード長 684 bytes
コンパイル時間 1,246 ms
コンパイル使用メモリ 81,544 KB
実行使用メモリ 141,188 KB
最終ジャッジ日時 2023-10-17 05:25:53
合計ジャッジ時間 7,193 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
59,040 KB
testcase_01 AC 41 ms
59,040 KB
testcase_02 AC 262 ms
105,700 KB
testcase_03 AC 245 ms
105,412 KB
testcase_04 AC 246 ms
105,660 KB
testcase_05 AC 302 ms
141,188 KB
testcase_06 AC 205 ms
82,420 KB
testcase_07 AC 245 ms
105,684 KB
testcase_08 AC 208 ms
84,852 KB
testcase_09 AC 238 ms
102,556 KB
testcase_10 AC 276 ms
120,084 KB
testcase_11 AC 259 ms
107,496 KB
testcase_12 AC 83 ms
100,052 KB
testcase_13 AC 93 ms
101,856 KB
testcase_14 AC 86 ms
100,568 KB
testcase_15 AC 146 ms
133,788 KB
testcase_16 AC 146 ms
133,788 KB
testcase_17 AC 145 ms
133,784 KB
testcase_18 AC 148 ms
134,996 KB
testcase_19 AC 99 ms
108,556 KB
testcase_20 AC 41 ms
59,096 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    n = int(input())
    r = list(map(int, input().split()))
    g = list(map(int, input().split()))
    b = list(map(int, input().split()))
    rn = [0] * 3001
    gn = [0] * 3001
    bn = [0] * 3001
    for i in range(n):
        rn[r[i]] += 1
    for i in range(n):
        gn[g[i]] += 1
    for i in range(n):
        bn[b[i]] += 1
    cumR = [0] * 3001
    for r in range(1, 3001):
        cumR[r] = cumR[r - 1] + rn[r]
    ans = 0
    for g in range(1, 3001):
        if gn[g] != 0:
            for b in range(1, 3001):
                if bn[b] != 0:
                    ans += gn[g] * bn[b] * (cumR[min(g + b - 1, 3000)] - cumR[max(g, b) - 1])
    print(ans)
main()
0