結果

問題 No.1623 三角形の制作
ユーザー moshi777
提出日時 2021-07-23 23:50:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 702 bytes
コンパイル時間 170 ms
コンパイル使用メモリ 82,000 KB
実行使用メモリ 138,984 KB
最終ジャッジ日時 2024-07-18 23:41:26
合計ジャッジ時間 3,542 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 1 WA * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

from itertools import accumulate
from collections import defaultdict
from bisect import bisect_right, bisect_left
N = int(input())

R = list(map(int, input().split()))
G = list(map(int, input().split()))
B = list(map(int, input().split()))

B.sort()

# rdd = defaultdict(int)
# gdd = defaultdict(int)

rnum = [0]*(3*10**3+1)
gnum = [0]*(3*10**3+1)
bnum = [0]*(3*10**3+1)

for i in range(N):
    # rdd[R[i]] += 1
    # gdd[G[i]] += 1
    rnum[R[i]] += 1
    gnum[G[i]] += 1
    bnum[B[i]] += 1
bnum_cum = [0] + list(accumulate(bnum))

ans = 0
maxR = max(R)
for i in range(1, maxR+1):
    for j in range(1, i+1):
        add = rnum[i]*gnum[j]*(bnum_cum[i] - bnum_cum[i-j])
        ans += add

print(ans)
0