結果

問題 No.1623 三角形の制作
ユーザー lllllll88938494
提出日時 2023-05-10 09:41:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 351 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 157 ms
コンパイル使用メモリ 82,376 KB
実行使用メモリ 141,596 KB
最終ジャッジ日時 2024-11-26 14:13:47
合計ジャッジ時間 5,415 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #

# max(g,b) <= r < g+b
from bisect import bisect_left as bl , bisect_right as br
from collections import Counter

n = int(input())
r = list(map(int,input().split()))
g = list(map(int,input().split()))
b = list(map(int,input().split()))

rs=sorted(tuple(Counter(r).items()))
gs=sorted(tuple(Counter(g).items()))
bs=sorted(tuple(Counter(b).items()))
rcnt = [0]*10**6
for i,j in rs:
    rcnt[i]=j

for i in range(1,10**6):
    rcnt[i] += rcnt[i-1]

ans=0

for i in range(len(gs)):
    for j in range(len(bs)):
        y=gs[i][0]+bs[j][0]
        x=max(gs[i][0],bs[j][0])
        t1=rcnt[max(y-1,0)]-rcnt[max(x-1,0)]
        ans += t1*gs[i][1]*bs[j][1]
        
print(ans)
        

0