結果
| 問題 | No.1623 三角形の制作 | 
| コンテスト | |
| ユーザー |  ayaoni | 
| 提出日時 | 2021-07-23 21:59:50 | 
| 言語 | PyPy3 (7.3.15) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 181 ms / 2,000 ms | 
| コード長 | 976 bytes | 
| コンパイル時間 | 199 ms | 
| コンパイル使用メモリ | 82,688 KB | 
| 実行使用メモリ | 135,708 KB | 
| 最終ジャッジ日時 | 2024-07-18 17:41:56 | 
| 合計ジャッジ時間 | 3,995 ms | 
| ジャッジサーバーID (参考情報) | judge2 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 2 | 
| other | AC * 19 | 
ソースコード
import sys
from itertools import accumulate
sys.setrecursionlimit(10**7)
def I(): return int(sys.stdin.readline().rstrip())
def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def LI2(): return list(map(int,sys.stdin.readline().rstrip()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def LS2(): return list(sys.stdin.readline().rstrip())
n = I()
R = LI()
G = LI()
B = LI()
count_R = [0]*(3*10**3+1)
count_G = [0]*(3*10**3+1)
count_B = [0]*(3*10**3+1)
for r in R:
    count_R[r] += 1
for g in G:
    count_G[g] += 1
for b in B:
    count_B[b] += 1
S_count_B = list(accumulate(count_B))
ans = 0
for i in range(1,3*10**3+1):
    cr = count_R[i]
    if not cr:
        continue
    for j in range(1,i+1):
        cg = count_G[j]
        if not cg:
            continue
        ans += cr*cg*(S_count_B[i]-S_count_B[i-j])
print(ans)
            
            
            
        