結果

問題 No.1623 三角形の制作
ユーザー lllllll88938494lllllll88938494
提出日時 2023-05-10 09:25:12
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 815 bytes
コンパイル時間 282 ms
コンパイル使用メモリ 86,720 KB
実行使用メモリ 124,036 KB
最終ジャッジ日時 2023-08-17 16:39:53
合計ジャッジ時間 4,525 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
76,324 KB
testcase_01 AC 98 ms
71,516 KB
testcase_02 TLE -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

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]
for i in range(len(rs)):
    rcnt.append(rcnt[-1]+rs[i][1])

rk = [0]+[i for i,j in rs]

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])
        if x >= y:
            continue
        
        xind,yind=bl(rk,x),bl(rk,y)
        xind=max(xind-1,0)
        yind=max(yind-1,0)
        
        t1=rcnt[yind]-rcnt[xind]
        ans += t1*gs[i][1]*bs[j][1]
        
print(ans)
        

0