結果
問題 |
No.1623 三角形の制作
|
ユーザー |
|
提出日時 | 2021-12-08 22:02:49 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 811 bytes |
コンパイル時間 | 213 ms |
コンパイル使用メモリ | 82,048 KB |
実行使用メモリ | 138,592 KB |
最終ジャッジ日時 | 2024-07-16 09:56:19 |
合計ジャッジ時間 | 5,165 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 9 WA * 10 |
ソースコード
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 - i): if B_len_cnt[j] == 0: continue ans += G_len_cnt[i] * B_len_cnt[j] * (accumR_len_cnt[i + j - 1] - accumR_len_cnt[max(i, j) - 1]) print(ans)