結果

問題 No.1623 三角形の制作
ユーザー lllllll88938494lllllll88938494
提出日時 2023-05-10 09:41:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 392 ms / 2,000 ms
コード長 678 bytes
コンパイル時間 266 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 139,704 KB
最終ジャッジ日時 2023-08-17 16:49:24
合計ジャッジ時間 6,847 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 97 ms
84,316 KB
testcase_01 AC 99 ms
84,356 KB
testcase_02 AC 332 ms
119,416 KB
testcase_03 AC 336 ms
118,800 KB
testcase_04 AC 331 ms
118,788 KB
testcase_05 AC 392 ms
132,236 KB
testcase_06 AC 292 ms
92,748 KB
testcase_07 AC 336 ms
118,808 KB
testcase_08 AC 287 ms
95,048 KB
testcase_09 AC 326 ms
116,972 KB
testcase_10 AC 352 ms
123,116 KB
testcase_11 AC 344 ms
120,232 KB
testcase_12 AC 133 ms
110,592 KB
testcase_13 AC 142 ms
110,664 KB
testcase_14 AC 138 ms
114,116 KB
testcase_15 AC 202 ms
139,704 KB
testcase_16 AC 205 ms
139,560 KB
testcase_17 AC 205 ms
139,380 KB
testcase_18 AC 215 ms
134,360 KB
testcase_19 AC 160 ms
126,100 KB
testcase_20 AC 101 ms
84,292 KB
権限があれば一括ダウンロードができます

ソースコード

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