結果

問題 No.1623 三角形の制作
ユーザー yosaka
提出日時 2021-07-30 19:43:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 520 ms / 2,000 ms
コード長 570 bytes
コンパイル時間 415 ms
コンパイル使用メモリ 82,048 KB
実行使用メモリ 141,276 KB
最終ジャッジ日時 2024-09-15 19:27:56
合計ジャッジ時間 7,591 ms
ジャッジサーバーID
(参考情報)
judge1 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter


def main():
    n = int(input())
    R = list(map(int, input().split()))
    G = list(map(int, input().split()))
    B = list(map(int, input().split()))
    # R.sort()
    # G.sort()
    # B.sort()
    Rc = Counter(R)
    Gc = Counter(G)
    Bc = Counter(B)
    S = [0] * 10 ** 4
    for r in Rc.keys():
        S[r] += Rc[r]
    for i in range(len(S)):
        S[i] += S[i - 1]
    ans = 0
    for g in Gc.keys():
        for b in Bc.keys():
            ans += Gc[g] * Bc[b] * (S[g + b - 1] - S[max(g, b) - 1])
    print(ans)


main()
0