結果

問題 No.1623 三角形の制作
ユーザー norioc
提出日時 2022-05-18 20:05:37
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 282 ms / 2,000 ms
コード長 451 bytes
コンパイル時間 121 ms
コンパイル使用メモリ 82,256 KB
実行使用メモリ 141,292 KB
最終ジャッジ日時 2024-09-16 23:19:58
合計ジャッジ時間 5,206 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import Counter
from itertools import accumulate

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

size = 3010
bs = [0] * size
for b in B:
    bs[b] += 1
cum = list(accumulate(bs))

rs = Counter(R)
gs = Counter(G)
ans = 0
for r in rs:
    for g in range(1, r+1):
        if gs[g] == 0: continue
        ans += (cum[r] - cum[r-g]) * rs[r] * gs[g]

print(ans)
0