AcWing 1236. 递增三元组
原题链接
中等
作者:
二十六
,
2025-04-05 17:14:56
· 辽宁
,
所有人可见
,
阅读 1
n = int(input())
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a = sorted(a)
b = sorted(b)
c = sorted(c)
i = 0
j = 0
k = 0
ans = 0
bb = [0] * len(b)
bp = 0
ap = 0
while bp < len(b):
while ap < len(a) and a[ap] < b[bp]:
ap += 1
bb[bp] = ap
bp += 1
cp = 0
cc = [0] * len(c)
bp = 0
while cp < len(c):
while bp < len(b) and b[bp] < c[cp]:
cc[cp] += bb[bp]
bp += 1
if cp > 0:
cc[cp] += cc[cp - 1]
cp += 1
print(sum(cc))