結果

問題 No.1623 三角形の制作
ユーザー lloyz
提出日時 2021-12-08 22:09:03
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 846 bytes
コンパイル時間 267 ms
コンパイル使用メモリ 12,928 KB
実行使用メモリ 37,528 KB
最終ジャッジ日時 2024-07-16 09:59:58
合計ジャッジ時間 4,100 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other TLE * 1 -- * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop, heappush
from collections import defaultdict

n = int(input())
R = list(map(int, input().split()))
G = list(map(int, input().split()))
B = list(map(int, input().split()))

R_len_cnt = [0 for _ in range(3001)]
G_len_cnt = [0 for _ in range(3001)]
B_len_cnt = [0 for _ in range(3001)]
for i in range(n):
    R_len_cnt[R[i]] += 1
    G_len_cnt[G[i]] += 1
    B_len_cnt[B[i]] += 1
accumR_len_cnt = [0 for _ in range(3001)]
for i in range(3000):
    accumR_len_cnt[i + 1] += accumR_len_cnt[i] + R_len_cnt[i + 1]
ans = 0
for i in range(1, 3001):
    if G_len_cnt[i] == 0:
        continue
    for j in range(1, 3001):
        if B_len_cnt[j] == 0:
            continue
        ans += G_len_cnt[i] * B_len_cnt[j] * (accumR_len_cnt[min(i + j, 3001) - 1] - accumR_len_cnt[max(i, j) - 1])
print(ans)

0