結果
問題 |
No.1623 三角形の制作
|
ユーザー |
![]() |
提出日時 | 2021-07-23 23:04:31 |
言語 | PyPy3 (7.3.15) |
結果 |
TLE
|
実行時間 | - |
コード長 | 597 bytes |
コンパイル時間 | 175 ms |
コンパイル使用メモリ | 82,192 KB |
実行使用メモリ | 146,076 KB |
最終ジャッジ日時 | 2024-07-18 20:28:33 |
合計ジャッジ時間 | 13,011 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 TLE * 10 |
ソースコード
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)