結果

問題 No.1623 三角形の制作
コンテスト
ユーザー moshi777
提出日時 2021-07-23 23:04:31
言語 PyPy3
(7.3.17)
コンパイル:
pypy3 -mpy_compile _filename_
実行:
pypy3 _filename_
結果
AC  
(最新)
TLE  
(最初)
実行時間 1,873 ms / 2,000 ms
+ 62µs
コード長 597 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 220 ms
コンパイル使用メモリ 96,108 KB
実行使用メモリ 169,928 KB
最終ジャッジ日時 2026-08-17 16:31:09
合計ジャッジ時間 20,245 ms
ジャッジサーバーID
(参考情報)
judge1_0 / judge2_0
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 19
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

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)

for i in range(N):
    rdd[R[i]] += 1
    gdd[G[i]] += 1

#print(rdd, gdd)

ans = 0
for r, rv in rdd.items():
    for g, gv in gdd.items():
        #print(r, rv, g, gv)
        if r < g:
            continue
        add = rv*gv*(bisect_right(B, r) - bisect_right(B, r-g))
        # print(add)
        ans += max(0, add)

print(ans)
0