結果
問題 |
No.1623 三角形の制作
|
ユーザー |
|
提出日時 | 2021-12-08 22:08:42 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 293 ms / 2,000 ms |
コード長 | 818 bytes |
コンパイル時間 | 179 ms |
コンパイル使用メモリ | 82,184 KB |
実行使用メモリ | 138,324 KB |
最終ジャッジ日時 | 2024-07-16 09:59:27 |
合計ジャッジ時間 | 4,960 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 19 |
ソースコード
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)