input stringlengths 20 127k | target stringlengths 20 119k | problem_id stringlengths 6 6 |
|---|---|---|
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
cnt = 0
for a in A:
for b in B:
for c in C:
if a < b < c:
cnt += 1
print(cnt)
| import bisect
n = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
cnt = 0
for b in B:
mid = bisect.bisect_left(A, b)
bottom = n - bisect.bisect_right(C, b)
cnt += mid*bottom
print(cnt... | p03557 |
import bisect as bi
n = int(eval(input()))
kariA = list(map(int,input().split()))
kariB = list(map(int,input().split()))
kariC = list(map(int,input().split()))
A = sorted(kariA)
B = sorted(kariB)
C = sorted(kariC)
count = 0
for c in C:
for b in B[:bi.bisect_left(B,c)]:
count += bi.bisect_left... | import bisect as bi
n = int(eval(input()))
kariA = list(map(int,input().split()))
kariB = list(map(int,input().split()))
kariC = list(map(int,input().split()))
A = sorted(kariA)
B = sorted(kariB)
C = sorted(kariC)
count = 0
Clength = len(C)
for b in B:
count += bi.bisect_left(A,b)*(Clength - bi.bisect_ri... | p03557 |
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
def func(array, value):
ng = -1
ok = len(array)
#if value
while ok - ng > 1:
mid = (ok + ng)//2
if array[mid] < value:
... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
def low_func(array, value):
ng = -1
ok = len(array)
#if value
while ok - ng > 1:
mid = (ok + ng)//2
if array[mid] < value:
... | p03557 |
import bisect as bs
n = int(eval(input()))
a_l = list(map(int, input().split()))
b_l = list(map(int, input().split()))
c_l = list(map(int, input().split()))
a_l.sort()
b_l.sort()
c_l.sort()
ans = 0
for i in range(n):
index_1 = bs.bisect_right(b_l,a_l[i])
for j in range(index_1,n):
in... | import bisect as bs
n = int(eval(input()))
a_l = list(map(int, input().split()))
b_l = list(map(int, input().split()))
c_l = list(map(int, input().split()))
a_l.sort()
b_l.sort()
c_l.sort()
ans = 0
for b in b_l:
ans += bs.bisect_left(a_l,b) * (n-bs.bisect_right(c_l,b))
print(ans)
'''
以下の方法だ... | p03557 |
n = int(eval(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)
# x以上のイテレータを
def lower_bound(arr , x):
l = 0
r = len(c)
for j in range(100):
mid = (l + r) // 2
... | n = int(eval(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)
# x以上のイテレータを
def lower_bound(arr , x):
l = 0
r = len(c)
for j in range(30):
mid = (l + r) // 2
... | p03557 |
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
def binary_search(k, x):
index = bisect.bisect_right(k, x)
if index == len(k):
return False
else:
#... | import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
def binary_upper(k, x):
return len(k) - bisect.bisect_right(k, x)
def binary_lower(k, x):
return bisect.bisect_left(k... | p03557 |
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
cnt = 0
for i in a:
x = bisect.bisect_right(b,i)
for j in b[x:]:
y = bisect.bisect_right(c,j)
cnt += n-y
b = b[x:]
print (cn... | import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
cnt = 0
for i in b:
x = bisect.bisect_left(a,i)
y = bisect.bisect_right(c,i)
cnt += x*(n-y)
print (cnt)
| p03557 |
import bisect
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for i in range(n):
canB = bisect.bisect_right(B, A[i])
if canB == n:
continue
else:
for j in range(canB, n):
... | import bisect
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for i in range(n):
canA = bisect.bisect_left(A, B[i])
canC = bisect.bisect_right(C, B[i])
ans += (canA)*(n-canC)
print(... | p03557 |
import bisect
n = int(eval(input()))
A = sorted([int(i) for i in input().split()] )
B = sorted([int(i) for i in input().split()] )
C = sorted([int(i) for i in input().split()] )
result = 0
for c in C:
B_sub = B[:bisect.bisect_left(B,c)]
for b in B_sub:
result += bisect.bisect_left(A,b)
pr... | import bisect
n = int(eval(input()))
A = sorted([int(i) for i in input().split()] )
B = sorted([int(i) for i in input().split()] )
C = sorted([int(i) for i in input().split()] )
b_count = []
pre_b = 0
for b in B:
current_count = bisect.bisect_left(A,b)
b_count.append(pre_b + current_count)
pre_... | p03557 |
def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort()
B.sort()
C.sort()
ans = 0
left = 0
for a in A:
right = left
while left < N and a >= B[left]:... | def main():
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort()
B.sort()
C.sort()
def is_ok1(mid, S, K):
if K <= S[mid]:
return True
else:
r... | p03557 |
def I(): return int(eval(input()))
def LI(): return list(map(int,input().split()))
def MI(): return list(map(int,input().split()))
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]
def isOK(index,key,li):
if li[index] >= key:
#不等号にイコールを入れないとokはliの中でkey以下の数字がいくつあるかを表し、
#... | import bisect
def I(): return int(eval(input()))
def LI(): return list(map(int,input().split()))
def MI(): return list(map(int,input().split()))
def LLI(n): return [list(map(int, input().split())) for _ in range(n)]
#bisect.bisect_left(list,key)はlistのなかでkey未満の数字がいくつあるかを返す
#bisect.bisect_right(list, key)はlistの... | p03557 |
import bisect
n=int(eval(input()))
a=[int(i) for i in input().split()]
b=[int(i) for i in input().split()]
c=[int(i) for i in input().split()]
a.sort()
b.sort()
c.sort()
s=bisect.bisect_left(a,b[-1])
l=bisect.bisect_right(c,b[0])
cnt=0
ab=[]
for B in b:
for A in a[:s+1]:
if B>A:
a... | import bisect
n=int(eval(input()))
a=sorted([int(i) for i in input().split()])
b=sorted([int(i) for i in input().split()])
c=sorted([int(i) for i in input().split()])
ans=0
for B in b:
m=bisect.bisect_left(a,B)
l=bisect.bisect_right(c,B)
ans+=m*(n-l)
print(ans) | p03557 |
n = int(eval(input()))
ai = []
bi = []
ci = []
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in input().split()]
a.sort(reverse=True)
b.sort(reverse=True)
c.sort(reverse=True)
for i in range(0,n):
cnt = 0
for j in range(0,n):
if a[i] >= b[j]... | n = int(eval(input()))
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))
bmul = [0]*(n+1)
ci = 0
for bi in range(n):
while ci != n and c[ci] <= b[bi]:
ci += 1
bmul[bi] = n-ci
for i in range(n):
bmul[n-i-1] ... | p03557 |
#ABC077-C
N=int(eval(input()))
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
ans=0
for i in range(N):
b=B[i]
if A[-1]<b:
a_comb=N
elif A[0]>=b:
a_comb=0
elif A[0]<b and A[1]>=b:
a_comb=1
... | #ABC077-C
N=int(eval(input()))
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
ans=0
for i in range(N):
b=B[i]
left=0
right=N-1
if A[-1]<b:
a_comb=N
elif A[0]>=b:
a_comb=0
elif A[0]<b and A... | p03557 |
# -*- coding: utf-8 -*-
import bisect
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
Ac, Cc = [0]*n, [0]*n
Ap, Cp = 0, 0
for i in range(n):
index = bisect.bisect_left(A[Ap:], B[i]... | # -*- coding: utf-8 -*-
import bisect
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
Ac, Cc = [0]*n, [0]*n
# Ap, Cp = 0, 0
for i in range(n):
Ac[i] = bisect.bisect_left(A, B[i... | p03557 |
# -*- coding: utf-8 -*-
import bisect
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
Ac, Cc = [0]*n, [0]*n
# Ap, Cp = 0, 0
for i in range(n):
Ac[i] = bisect.bisect_left(A, B[i... | import bisect
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
print((sum([bisect.bisect_left(A, b) * (N - bisect.bisect(C, b)) for b in B])))
| p03557 |
import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
B = list(map(int, input().split()))
B.sort()
C = list(map(int, input().split()))
C.sort()
count = [0]*N
answer = 0
z = 0
for i in range(N):
if B[0] >= C[N-i-1]:
break
z += 1
coun... | import sys
input = sys.stdin.readline
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)
count = [0]*N
answer = 0
z = 0
for i in range(N):
if B[N-1] >= C[i]:
... | p03557 |
import bisect
n=int(eval(input()))
A=sorted(list(map(int,input().split())))
B=list(map(int,input().split()))
C=sorted(list(map(int,input().split())))
lb,lc=len(B),len(C)
ans=0
for b in range(lb):
ma = bisect.bisect_left(A, B[b])
mc = lc-bisect.bisect_right(C, B[b])
ans += ma*mc
print(ans) | import bisect
n=int(eval(input()))
A=sorted(list(map(int,input().split())))
B=list(map(int,input().split()))
C=sorted(list(map(int,input().split())))
lc=len(C)
ans=0
for b in B:
ma = bisect.bisect_left(A, b)
mc = lc-bisect.bisect_right(C, b)
ans += ma*mc
print(ans) | p03557 |
import bisect
def main():
n=int(eval(input()))
A=sorted(list(map(int,input().split())))
B=list(map(int,input().split()))
C=sorted(list(map(int,input().split())))
lc=len(C)
ans=0
for b in B:
ma = bisect.bisect_left(A, b)
mc = lc-bisect.bisect_right(C, b)
ans += ma*mc
print(ans)
... | import sys
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
def main():
n=int(eval(input()))
A=sorted(list(map(int,input().split())))
B=list(map(int,input().split()))
C=sorted(list(map(int,input().split())))
lc=len(C)
ans=0
for b in B:
ma = bisect_left(A, b)
mc =... | p03557 |
import bisect
n=eval(input())
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0
for B in b:
ans+=(bisect.bisect_left(a,B))*(len(c)-(bisect.bisect_right(c,B)))
print(ans) | import bisect
n=int(eval(input()))
a=sorted(list(map(int,input().split())))
b=sorted(list(map(int,input().split())))
c=sorted(list(map(int,input().split())))
ans=0
for i in b:
A=bisect.bisect_left(a,i)
C=bisect.bisect(c,i)
ans+=A*(n-C)
print(ans)
| p03557 |
import bisect
N = int(eval(input()))
Alist = [int(x) for x in input().split()]
Blist = [int(x) for x in input().split()]
Clist = [int(x) for x in input().split()]
Alist.sort()
Blist.sort()
Clist.sort()
cache = []
result = 0
doneb = 0
donea = 0
for c in Clist:
idxc = bisect.bisect_left(Blist, c)
... | import bisect
N = int(eval(input()))
Alist = [int(x) for x in input().split()]
Blist = [int(x) for x in input().split()]
Clist = [int(x) for x in input().split()]
Alist.sort()
Blist.sort()
Clist.sort()
result = 0
for b in Blist:
a = bisect.bisect_left(Alist, b)
c = N - bisect.bisect_right(Clist, ... | p03557 |
import bisect
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for up in a:
tmp1 = bisect.bisect_right(b, up)
for middle in b[tmp1:]:
down = bisect.bisect_right(c, middle... | import bisect
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for middle in b:
tmp1 = bisect.bisect_left(a, middle)
tmp2 = bisect.bisect_right(c, middle)
ans += tmp1 * (n - ... | p03557 |
import bisect
n = int(eval(input()))
a_li = list(map(int, input().split()))
b_li = list(map(int, input().split()))
c_li = list(map(int, input().split()))
b_li.sort()
c_li.sort()
check_li = [0]*(n+10)
for i in range(len(b_li)):
s = bisect.bisect_right(c_li, b_li[i])
check_li[i] = len(c_li[s:])
... | import bisect
n = int(eval(input()))
a_li = list(map(int, input().split()))
b_li = list(map(int, input().split()))
c_li = list(map(int, input().split()))
a_li.sort()
b_li.sort()
c_li.sort()
ans = 0
for i in b_li:
s = bisect.bisect_right(c_li, i)
s_num = n-s
t = bisect.bisect_left(a... | p03557 |
n = int(eval(input()))
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))
A_list = sorted(A_list)
B_list = sorted(B_list)
C_list = sorted(C_list)
cnt = 0
def is_ok(arg):
return B_list[arg] > A_list[i]
def bisect(ng, ok):
whil... | n = int(eval(input()))
A_list = list(map(int, input().split()))
B_list = list(map(int, input().split()))
C_list = list(map(int, input().split()))
A_list = sorted(A_list)
B_list = sorted(B_list)
C_list = sorted(C_list)
cnt = 0
def is_ok(arg): # B より小さい最大の A
return A_list[arg] < B_list[i]
def bisect(ng,... | p03557 |
def main():
N = int(eval(input()))
A = list(map(int, input().split()))
B = sorted(list(map(int, input().split())), reverse=True)
C = sorted(list(map(int, input().split())))
ans = 0
for a in A:
for b in B:
if a >= b:
break
for i, c in en... | import bisect
def main():
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
ans = 0
for b in B:
ans += bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b))
pr... | p03557 |
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
bi = [n for _ in range(n)]
for i in range(n):
for j in range(n):
if b[i] <= a[j]:
bi[i] = j
break
ans = 0
for i ... | import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0;
for bj in b:
ai = bisect.bisect_left(a, bj);
ck = n - bisect.bisect_right(c, bj);
ans += ai * ck;
print(ans)
| p03557 |
from bisect import bisect_left
from collections import defaultdict
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
num_a = 0
num_c = 0
res = 0
pre_b = -1
dict_C = defaultdict(int)
for b in B:
... | from bisect import bisect_left
from collections import defaultdict
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
num_a = 0
num_c = 0
res = 0
pre_b = -1
dict_C = defaultdict(int)
for b in B:
... | p03557 |
from bisect import bisect_left
from collections import defaultdict
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
num_a = 0
num_c = 0
res = 0
pre_b = -1
dict_C = defaultdict(int)
for b in B:
... | from bisect import bisect_left
from bisect import bisect_right
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
num_a = 0
num_c = 0
res = 0
pre_b = -1
for b in B:
if b == pre_b:
res ... | p03557 |
# abc077_c.py
'''
多分あとは、Bで重複がある場合は探索しないで個数かけていくとかにしないといけない。
'''
def is_okC(idx,key,target):
########## wirte criteria here ##########
if target[idx] > key:
return True
return False
def meguru_bisectC(key,target):
left = -1
right = len(target)
while (abs(right - left) > 1):
... | # abc077_c.py
'''
多分あとは、Bで重複がある場合は探索しないで個数かけていくとかにしないといけない。
'''
def is_okC(idx,key,target):
########## wirte criteria here ##########
if target[idx] > key:
return True
return False
def meguru_bisectC(key,target):
left = -1
length = len(target)
right = length
while (abs(rig... | p03557 |
def bisect(lst, isok, ok, ng):
while(abs(ok-ng)>1):
mid = (ok+ng)//2
if isok(lst[mid]):
ok = mid
else:
ng = mid
return [ok, ng]
n = int(eval(input()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in inp... | def bisect(lst, isok, ok, ng):
while(abs(ok-ng)>1):
mid = (ok+ng)//2
if isok(lst[mid]):
ok = mid
else:
ng = mid
return [ok, ng]
n = int(eval(input()))
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]
c = [int(i) for i in inp... | p03557 |
import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect
n = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.so... | import sys
import itertools
sys.setrecursionlimit(1000000000)
from heapq import heapify,heappop,heappush,heappushpop
import math
import collections
import copy
import bisect
n = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.so... | p03557 |
#!/usr/bin/env python3
import sys
from bisect import bisect_right
def solve(N: int, A: "List[int]", B: "List[int]", C: "List[int]"):
ans = 0
A.sort()
B.sort()
C.sort()
for i in range(N):
bi = bisect_right(B, A[i])
for j in range(bi, N):
ci = bisect_right(C... | #!/usr/bin/env python3
import sys
from bisect import bisect_right, bisect_left
def solve(N: int, A: "List[int]", B: "List[int]", C: "List[int]"):
ans = 0
A.sort()
B.sort()
C.sort()
for i in range(N):
ai = bisect_left(A, B[i])
ci = bisect_right(C, B[i])
ans += ... | p03557 |
import bisect
N=int(eval(input()))
A=[int(x) for x in input().split()]
B=[int(x) for x in input().split()]
C=[int(x) for x in input().split()]
A.sort()
B.sort()
C.sort()
ans=0
for i in range(N):
a=bisect.bisect_right(C,B[i])
b=bisect.bisect_left(A,B[i])
ans+=(N-a)*b
print(ans) | import bisect
N=int(eval(input()))
A=[int(x) for x in input().split()]
B=[int(x) for x in input().split()]
C=[int(x) for x in input().split()]
A.sort()
B.sort()
C.sort()
ans=0
for i in range(N):
ans+=(bisect.bisect_left(A,B[i])*(N-bisect.bisect_right(C,B[i])))
print(ans) | p03557 |
from collections import Counter
import bisect
N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
a_raw=Counter(A)
b_raw=Counter(B)
c_raw=Counter(C)
a=sorted(list(a_raw.items()), key=lambda x: x[0])
c=sorted(list(c_raw.items()), key=lam... | import bisect
N=int(eval(input()))
A=list(map(int,input().split()))
B=list(map(int,input().split()))
C=list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for i in B:
ins_a = bisect.bisect_left(A,i)
ins_c = bisect.bisect_right(C,i)
ans+=ins_a*(N-ins_c)
print(ans)
| p03557 |
# coding:utf-8
import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
def dfs(s, prev, pre):
val[s] += Ope[s] + prev
for i in G[s]:
if(i == pre):
conti... | # coding:utf-8
import sys
import math
import time
#import numpy as np
import collections
from collections import deque
from collections import Counter
import queue
import copy
import bisect
import heapq
def dfs(s, prev, pre):
val[s] += Ope[s] + prev
for i in G[s]:
if(i == pre):
conti... | p03557 |
import bisect
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
lb = [0] * len(B)
for i in range(len(B)):
lb[i]= bisect.bisect_left(A,B[i])
ans = 0
for i in range(len(C)):
temp = bisect.bi... | import bisect
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
lb = [0] * (len(B)+1)
lsum = [0] * (len(B)+1)
temp = 0
for i in range(len(B)):
lb[i]= bisect.bisect_left(A,B[i])
for i in range(... | p03557 |
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
b_bt = []
c_bt = []
for i in range(n):
b_bt.append(bisect.bisect_left(a, b[i]))
c_bt.append(bisect.bisect_left(b, c[i])-1)... | import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
result = 0
for i in range(n):
x = bisect.bisect_left(a, b[i])
y = n - bisect.bisect_right(c, b[i])
result += x*y
... | p03557 |
# -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
return N, A, B, C
def binary_se... | # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
return N, A, B, C
def get_lb(l:... | p03557 |
# -*- coding: utf-8 -*-
# モジュールのインポート
import itertools
# 標準入力を取得
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
# 求解処理
def get_ub(l: list, x: int) -> int:
low = -1
high = len(l)
while 1 < high - low:
... | # -*- coding: utf-8 -*-
def get_input() -> tuple:
"""
標準入力を取得する.
Returns:\n
tuple: 標準入力
"""
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
return N, A, B, C
def get_lb(l:... | p03557 |
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
import bisect
N = INT()
A = LIST()
B = LIST()
C = LIST()
A.sort()
B.sort()
C.sort()
ans = 0
# for ai in A:
# i = bisect.bisect_right(B, ai)
# for bi in B[... | def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(): return list(map(int, input().split()))
# import bisect
N = INT()
A = LIST()
B = LIST()
C = LIST()
A.sort()
B.sort()
C.sort()
def binsearch(lst, th, ud="up"):
left, right = -1, len(lst)
while rig... | p03557 |
import bisect, functools, sys
sys.setrecursionlimit(10**6)
N = int(eval(input()))
A = sorted(int(x) for x in input().split())
B = sorted(int(x) for x in input().split())
C = sorted(int(x) for x in input().split())
@functools.lru_cache(maxsize=None)
def a(n):
return bisect.bisect_left(A, n)
b_cache = [0... | N = int(eval(input()))
A = sorted(int(x) for x in input().split())
B = sorted(int(x) for x in input().split())
C = sorted(int(x) for x in input().split())
import bisect
print((sum(bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b)) for b in B))) | p03557 |
import bisect
def main():
N = int(eval(input()))
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])
counter = 0
for c in C:
b_count = bisect.bisect_left(B, c)
for b in B[0:b_count]... | import bisect
def main():
N = int(eval(input()))
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])
counter = 0
for b in B:
a_count = bisect.bisect_left(A, b)
c_count = N - bisect.... | p03557 |
import math
import sys
import queue
import copy
import bisect#2分探索
def input():
return sys.stdin.readline()[:-1]
def inputi():
return int(input())
def inputl():
return list(map(int, input().split()))
def printl(li):
print(*li, sep="\n")
def argsort(s):
return sorted(range(len(s)), ke... | import sys
#import math
#import queue
#import copy
import bisect#2分探索
def input():
return sys.stdin.readline()[:-1]
def inputi():
return int(input())
def inputl():
return list(map(int, input().split()))
def printl(li):
print(*li, sep="\n")
def argsort(s):
return sorted(range(len(s)),... | p03557 |
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for i in range(N):
for j in range(N):
if A[i] < B[j]:
for k in range(N):
if B[j] < C[N-1-k]:
... | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for i in range(N):
a = bisect.bisect_left(A, B[i])
c = bisect.bisect_right(C, B[i])
ans += a*(N-c)
print(ans)
| p03557 |
import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for i in range(N):
a = bisect.bisect_left(A, B[i])
c = bisect.bisect_right(C, B[i])
ans += a*(N-c)
print(ans)
| from bisect import *
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in range(n):
ans += bisect_left(a, b[i])*(n-bisect_right(c, b[i]))
print(ans)
| p03557 |
import bisect
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
a2=[]
for i1 in range(N):
a2.append(bisect.bisect_left(C,B[i1]+1))
ans=0
for i0 in range(N):
a1 = bisect.bisect_left(B,A[i0]+1... | import bisect
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
a2=[]
for i1 in range(N):
a2.append(bisect.bisect_left(C,B[i1]+1))
a2c=[0]*(N+1)
for i1 in range(N-1,-1,-1):
a2c[i1] = a2c[i... | p03557 |
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def abc077_c():
N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
A.sort()
B.sort... | import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
def abc077_c():
N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
C = list(map(int, readline().split()))
A.sort()
B.sort... | p03557 |
N = int(eval(input()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
a_list.sort()
c_list.sort()
result = 0
for b in b_list:
a_count = list([x for x in a_list if x < b])
c_count = list([x for x in c_list if x >b])
resul... | import bisect
N = int(eval(input()))
a_list = list(map(int, input().split()))
b_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))
a_list.sort()
c_list.sort()
result = 0
for b in b_list:
a_count = bisect.bisect_left(a_list, b)
c_count = bisect.bisect_right(c_list, b)
... | p03557 |
import sys
import bisect
input = sys.stdin.readline
def slove():
n = int(eval(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)
ans = 0
for i in range(n):
... | import sys
import bisect
input = sys.stdin.readline
def slove():
n = int(eval(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)
ans = 0
for i in range(n):
... | p03557 |
import bisect
N = int(eval(input()))
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))
ans = 0
for second in B:
idx = bisect.bisect_left(A, second)
first = len(A[:idx])
idx = bisect.bisect_right(C, second)
third = len(C[id... |
import bisect
N = int(eval(input()))
A = sorted(map(int, input().split()))
B = list(map(int, input().split()))
C = sorted(map(int, input().split()))
ans = 0
for second in B:
ai = bisect.bisect_left(A, second)
ci = bisect.bisect_right(C, second)
ans += (ai*(N-ci))
print(ans) | p03557 |
import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
a = bisect.bisect_left(A, b) # 挿入点はどの同じ値よりも左
c = bisect.bisect_right(C, b) # 挿入点はどの同じ値よりも右
ans += a * (l... | import bisect
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
A=bisect.bisect_left(a,b[i])
B=bisect.bisect_right(c,b[i])
ans=ans+A*(n-B)
print(ans)
| p03557 |
import bisect
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
A=bisect.bisect_left(a,b[i])
B=bisect.bisect_right(c,b[i])
ans=ans+A*(n-B)
print(ans)
| n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
import bisect
ans=0
for i in b:
q=bisect.bisect_left(a,i)
s=bisect.bisect_right(c,i)
ans=ans+q*(n-s)
print(ans)
| p03557 |
from collections import Counter
N=int(eval(input()))
A=Counter(input().split())
B=Counter(input().split())
C=Counter(input().split())
ans=0
for a_key,a_count in A.most_common():
for b_key,b_count in B.most_common():
for c_key,c_count in C.most_common():
a_key,b_key,c_key=int(a_key),int(... | import bisect
N=int(eval(input()))
A=sorted(list(map(int,input().split())))
B=sorted(list(map(int,input().split())))
C=sorted(list(map(int,input().split())))
print((sum(bisect.bisect_left(A,b)*(N-bisect.bisect_right(C,b)) for b in B))) | p03557 |
import bisect
n=int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for k in b:
pos1 = bisect.bisect_left(a,k)
pos2 = bisect.bisect_right(c,k)
ans += (pos1*(n-pos2))
print(ans)
| import bisect
n=int(eval(input()))
a = sorted(list(map(int,input().split())))
b = sorted(list(map(int,input().split())))
c = sorted(list(map(int,input().split())))
ans = 0
for k in b:
pos1 = bisect.bisect_left(a,k)
pos2 = bisect.bisect_right(c,k)
ans += (pos1*(n-pos2))
print(ans)
| p03557 |
n = int(eval(input()))
A, B, C = [list(map(int, input().split())) for _ in range(3)]
cnt = 0
# O(3*N) でギリギリ?pythonだと微妙かも
# 真ん中のやつを基準にして上のやつと下のやつを比べて
# あるいはバイナリサーチ
for b in B:
a_cnt, c_cnt = 0, 0
for i in range(n):
if A[i]<b:
a_cnt+=1
if b<C[i]:
c_cnt+=1
... | # バイナリサーチで解く。
# Bの要素を基準にしてa<b<cとなるものを選ぶ。すべての配列はソート済みとして、
# a<bとなる最大のa, b<cとなる最小のcを選び、それら独立する事象の数の積を足していく
n = int(eval(input()))
A, B, C = [list(sorted(map(int, input().split()))) for _ in range(3)]
cnt = 0
def bs_left(lis, target):
# ソート済みのlisのうちtargetがどこに入るか(index)
# 要素がtargetと重複する場合はより小さいインデックス... | p03557 |
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for ai in a:
idx_b = bisect.bisect_right(b, ai)
if idx_b == n:
break
for bi in b[idx_b:]:
ans += n... | from itertools import accumulate
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
b_ = []
for bi in reversed(b):
b_.append(n - bisect.bisect_right(c, bi))
b_ = list(accumul... | p03557 |
import sys
import math
N = int(eval(input()))
A = list(map(int, input().split(' ')))
B = list(map(int, input().split(' ')))
C = list(map(int, input().split(' ')))
array1 = list()
for b in B:
count = 0
for c in C:
if b < c:
count += 1
array1.append(count)
ans = 0
for i i... | import sys
import math
N = int(eval(input()))
A = list(map(int, input().split(' ')))
B = list(map(int, input().split(' ')))
C = list(map(int, input().split(' ')))
A.sort()
B.sort()
C.sort()
array1 = list()
count = 0
f = 0
for j in range(N):
for i in range(f, N):
if B[N-1-j] < C[N-1-i]:
... | p03557 |
from bisect import bisect_left, bisect_right
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort()
C.sort()
result = 0
for i in range(N):
a = bisect_left(A,B[i])
c = bisect_right(C,B[i])
result += ... | from bisect import bisect_left, bisect_right
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort()
C.sort()
result = 0
for i in B:
a = bisect_left(A,i)
c = bisect_right(C,i)
result += a * (N - c)
... | p03557 |
import bisect
N=int(eval(input()))
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort()
B.sort()
C.sort()
# print(A)
# print(B)
# print(C)
# ans=0
# for i in range(N):
# part1=A[i]
# part2_pos=bisect.bisect_right(B,part1)
# f... | import bisect
N=int(eval(input()))
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort()
B.sort()
C.sort()
# print(A)
# print(B)
# print(C)
ans=0
for j in range(N):
a_num=bisect.bisect_left(A,B[j])
c_num=bisect.bisect_right(C,B[j])... | p03557 |
import bisect
N=int(eval(input()))
ue=list(map(int,input().split()))
naka=list(map(int,input().split()))
sita=list(map(int,input().split()))
ue.sort(),sita.sort(),naka.sort()
count=0
stop=[0]*N
for i in range(N):
k=naka[i]
stop_index=bisect.bisect_right(sita,k)
if stop_index!=N:
stop[i]=... | import bisect
N=int(eval(input()))
ue=list(map(int,input().split()))
naka=list(map(int,input().split()))
sita=list(map(int,input().split()))
sita.sort(),naka.sort(),ue.sort()
count2=[0]*N
count1=[0]*N
for i in range(N):
m = naka[i]
k=naka[i]
small=bisect.bisect_left(ue,k)
count1[i]=small
... | p03557 |
def search(key, L):
inc = -1
exc = N
while abs(inc-exc) > 1:
mid = (inc+exc) // 2
if True if L[mid] <= key else False:
inc = mid
else:
exc = mid
return exc
def main():
ans = 0
for a in A:
for i in range(search(a, B), N):
... | def search(key, L):
inc = -1
exc = N
while abs(inc-exc) > 1:
mid = (inc+exc) // 2
if True if L[mid] <= key else False:
inc = mid
else:
exc = mid
return exc
def main():
ans = 0
for a in A:
e = search(a, B)
if e < N:... | p03557 |
import bisect
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
A.sort()
B.sort()
C.sort()
up_mid = [N - bisect.bisect_right(B, x) for x in A]
mid_down = [N - bisect.bisect_right(C, x) for x in B]
ans = 0
for i in ... | import bisect
N = int(eval(input()))
A = [int(x) for x in input().split()]
B = [int(x) for x in input().split()]
C = [int(x) for x in input().split()]
A.sort()
B.sort()
C.sort()
ans = 0
for b in B:
ans += bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b))
print(ans) | p03557 |
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
AB = []
total = 0
for i in range(len(B)):
count = 0
for j in range(len(A)):
if A[j]<B[i]:
count+=1
AB.append(count)
for i in range(len(C)):
for j in range(len... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
AB = [0]*N
total = 0
for i in range(N):
left = -1
right = N
while right-left>1:
mid = left + (right-left)//2
if A[mid]>=B[i]:
r... | p03557 |
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
AB = [0]*N
total = 0
for i in range(N):
left = -1
right = N
while right-left>1:
mid = left + (right-left)//2
if A[mid]>=B[i]:
r... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
total = 0
for i in range(N):
left = -1
right = N
while right-left>1:
mid = left + (right-left)//2
if A[mid]>=B[i]:
right = mid
... | p03557 |
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort(reverse=True)
B = list(map(int, input().split()))
B.sort(reverse=True)
C = list(map(int, input().split()))
C.sort(reverse=True)
Bn = [0] * N
prea = 0
for b in range(N):
for a in range(prea, N):
if A[a] < B[b]:
prea =... | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
B = list(map(int, input().split()))
C = list(map(int, input().split()))
C.sort()
ans = 0
for i in range(N):
cnta = bisect.bisect_left(A, B[i])
cntc = bisect.bisect_right(C, B[i])
ans += cnta * (N - cntc)
print(... | p03557 |
def m():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
cnt = 0
for a in A:
for b in B:
for c in C:
if a < b and b < c:
cnt +=1
return cnt
... | def someone_ans():
def binary_search(L, key, mode):
low, high = 0, len(L)
mid = len(L) // 2
while low <= high - 1:
if L[mid] < key and mode == 0 or L[mid] <= key and mode == 1:
low = mid + 1
else:
high = mid
mid = (... | p03557 |
#!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L(): return sys.stdin.readline... | #!usr/bin/env python3
from collections import defaultdict, deque, Counter, OrderedDict
from bisect import bisect_left, bisect_right
from functools import reduce, lru_cache
from heapq import heappush, heappop, heapify
import itertools
import math, fractions
import sys, copy
def L(): return sys.stdin.readline... | p03557 |
def solve():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
A_cand = [0 for i in range(N)]
B_cand = [0 for i in range(N)]
for i in range(N):
... | def solve():
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
A_cand = [0 for i in range(N)]
B_cand = [0 for i in range(N)]
skip_loop = 0
... | p03557 |
import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
B = list(map(int, input().split()))
C = list(map(int, input().split()))
C.sort()
ans = 0
for b in B:
top = bisect.bisect_left(A, b)
bottom = N - bisect.bisect_right(C, b)
ans += top * bottom
print(ans) | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
B = list(map(int, input().split()))
C = list(map(int, input().split()))
C.sort()
ans = 0
for i in range(N):
top = bisect.bisect_left(A, B[i])
bottom = N - bisect.bisect_right(C, B[i])
ans += top * bottom
prin... | p03557 |
import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
A.sort()
B = list(map(int, input().split()))
C = list(map(int, input().split()))
C.sort()
ans = 0
for i in range(N):
top = bisect.bisect_left(A, B[i])
bottom = N - bisect.bisect_right(C, B[i])
ans += top * bottom
prin... | import bisect
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = list(map(int, input().split()))
C = sorted(list(map(int, input().split())))
ans = 0
for i in range(N):
top = bisect.bisect_left(A, B[i])
bottom = N - bisect.bisect_right(C, B[i])
ans += top * bottom
print(an... | p03557 |
N = int(eval(input()))
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))
sumSunuke = 0
def bs_left(list, target):
low, high = 0, len(list)
while low < high:
mid = (low + high) // 2
if list[mid] < target:
lo... | from bisect import bisect_left, bisect_right
N = int(eval(input()))
A = sorted(map(int, input().split()))
B = sorted(map(int, input().split()))
C = sorted(map(int, input().split()))
sumSunuke = 0
for x in range(N):
ab = bisect_left(A, B[x])
bc = N - bisect_right(C, B[x])
sumSunuke += ab * bc
p... | p03557 |
import bisect
n = int(eval(input()))
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
cl = list(map(int,input().split()))
al.sort()
bl.sort()
cl.sort()
cnt = 0
for b in bl:
a_num = bisect.bisect_left(al,b)
c_num = n - bisect.bisect_right(cl,b)
cnt += a_num*c_num
#... | import bisect
n = int(eval(input()))
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
cl = list(map(int,input().split()))
al.sort()
bl.sort()
cl.sort()
ans = 0
for b in bl:
a_num = bisect.bisect_left(al,b)
c_num = n - bisect.bisect_right(cl,b)
ans += a_num*c_num
pri... | p03557 |
import bisect
n = int(eval(input()))
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
cl = list(map(int,input().split()))
al.sort()
bl.sort()
cl.sort()
ans = 0
for b in bl:
a_num = bisect.bisect_left(al,b)
c_num = n - bisect.bisect_right(cl,b)
ans += a_num*c_num
pri... | from bisect import bisect_left, bisect_right
n = int(eval(input()))
al = list(map(int,input().split()))
bl = list(map(int,input().split()))
cl = list(map(int,input().split()))
al.sort()
bl.sort()
cl.sort()
ans = 0
for b in bl:
# b未満の要素の個数
a_cnt = bisect_left(al,b)
# bより大きい要素の個数
c_cnt = ... | p03557 |
import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
count = 0
for i in range(N):
index_b = bisect.bisect_right(B, A[i])
for j in range(index_b, N):
index_c = bisect... | import bisect
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
count = 0
for b in B:
index_b = bisect.bisect_left(A, b)
index_c = bisect.bisect_right(C, b)
count += (N - index_c) * index_b
... | p03557 |
n = int(eval(input()))
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))
ans = 0
for i in range(n):
for j in range(n - sum(x > a[i] for x in b), n):
ans += sum(x > b[j] for x in c)
print(ans) | from bisect import bisect_left, bisect_right
n = int(eval(input()))
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))
ans = 0
def bin_search(x, n, flag):
if flag == True:
return bisect_left(x, n)
else:
return bisect_righ... | p03557 |
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
adic = {}
bdic = {}
cdic = {}
for i in range(len(a)):
if a[i] in adic:
adic[a[i]] = adic[a[i]] + 1
else:
adic.update({a[i]:1})
for i in range(len(b)):... | N = int(eval(input()))
a = list(map(int,input().split(" ")))
b = list(map(int,input().split(" ")))
c = list(map(int,input().split(" ")))
#アルゴリズムわからないけどN log N?
a.sort()
b.sort()
c.sort()
#O(N)?
i,j,k = 0,0,0
ans = 0
while j < N:
while i < N and a[i]<b[j] :
i += 1
while k < N and c[k]<=b[j]:
... | p03557 |
import bisect
N = int(eval(input()))
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])
ans = 0
for i in B:
zyo = bisect.bisect_left(A, i)
ge = bisect.bisect_right(C, i)
ans += (N-ge)*zyo
#print(ans, z... | import bisect
N = int(eval(input()))
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])
ans = 0
for i in B:
ans += (bisect.bisect_left(A, i)) * (N-bisect.bisect_right(C, i))
print(ans) | p03557 |
import bisect
N = int(eval(input()))
A = sorted([int(i) for i in input().split()])
B = sorted([int(i) for i in input().split()])
C = sorted([int(i) for i in input().split()])
ans = 0
for i in B:
ans += (bisect.bisect_left(A, i)) * (N-bisect.bisect_right(C, i))
print(ans) | import bisect
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort()
B.sort()
C.sort()
ans = 0
for i in B:
num_A = bisect.bisect_left(A, i)
num_B = bisect.bisect_right(C, i)
ans += num_A * (N - num_B)
... | p03557 |
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
asort = sorted(a)
bsort = sorted(b)
csort = sorted(c)
res = 0
for ai in a:
bindex = bisect.bisect_right(bsort, ai)
if bindex == n:
continue
fo... | import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
bsort = sorted(b)
csort = sorted(c)
res = 0
asum = [0] * n
bsum = [0] * n
for i in range(n):
asum[i] = n - bisect.bisect_right(bsort, a[i])
for i in range(n):
... | p03557 |
n=int(eval(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)
c.reverse()
ans=0
max1=n-1
for x in range(n):
maxC=c[x]
min1=0
while max1-min1>1:
zantei=(max1+min1)//2
if b[zantei]>=maxC:
... | def bs_left(list, target):
low = 0
high = len(list)
while low < high:
mid = (low + high) // 2
if target > list[mid]:
low = mid + 1
else:
high = mid
return low
def bs_right(list, target):
low = 0
high = len(list)
while low < hig... | p03557 |
import bisect
n=int(eval(input()))
la=sorted(map(int,input().split()))
lb=sorted(map(int,input().split()))
lc=sorted(map(int,input().split()))
countb=[]
count1=0
for i in range(n):
index=bisect.bisect_left(la,lb[i])
countb.append(index)
countb2=[]
sum=0
for i in range(n):
sum+=countb[i]
countb2.ap... | import bisect
n=int(eval(input()))
la=sorted(map(int,input().split()))
lb=sorted(map(int,input().split()))
lc=sorted(map(int,input().split()))
ans=0
for i in range(n):
index1=bisect.bisect_left(la,lb[i])
index2=bisect.bisect_right(lc,lb[i])
ans+=index1*(n-index2)
print(ans) | p03557 |
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
cc = {}
for i in b:
cc[i] = n-bisect.bisect_right(c, i)
sum = 0
for i in a:
for j in [s for s in b if s > i]:
sum += c... | import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
sum = 0
for i in b:
sum += bisect.bisect_left(a, i)*(n-bisect.bisect_right(c, i))
print(sum) | p03557 |
n= int(eval(input()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
lal = sorted(al,reverse = True)
lbl = sorted(bl,reverse = True)
lcl = sorted(cl,reverse = True)
d =[0]*n
for i in range(n):
x = lbl[i]
for j in range(n):
... | n= int(eval(input()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
lal = sorted(al)
lbl = sorted(bl)
lcl = sorted(cl)
from bisect import bisect_left, bisect_right
res = 0
for i in range(n):
bx = lbl[i]
ax = bisect_left(lal... | p03557 |
import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in a:
bi = bisect.bisect_right(b,i)
for j in b[bi:]:
ci = bisect.bisect_right(c,j)
ans += (n-ci)
print(a... | import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
a.sort()
b.sort()
c.sort()
ans = 0
for i in b:
ai = bisect.bisect_left(a,i)
ci = bisect.bisect_right(c,i)
ans += ai*(n-ci)
print(ans) | p03557 |
import bisect
N = int(eval(input())) # それぞれのパーツの数
A = list(map(int, input().split())) # 小さい
B = list(map(int, input().split())) # 中くらい
C = list(map(int, input().split())) # 大きい
# Cは並び替え不要
A.sort()
B.sort()
total = 0
for c in C:
b_count = bisect.bisect_left(B, c) # bの数量
for b in B[:b_count]:
... | import bisect
import itertools
N = int(eval(input())) # それぞれのパーツの数
A = list(map(int, input().split())) # 小さい
B = list(map(int, input().split())) # 中くらい
C = list(map(int, input().split())) # 大きい
# Cは並び替え不要
A.sort()
B.sort()
# Bの各要素でAを二分探索して返ってきたindexを先に保有しておく
b_counts = [0] * N
for i in range(N):
b... | p03557 |
#create date: 2020-08-06 09:16
import sys
stdin = sys.stdin
from bisect import bisect_left
def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))
def main():
n = ni()
a = na()
b = na()
c = na()
a.sort()
b... | #create date: 2020-08-06 09:16
import sys
stdin = sys.stdin
from bisect import bisect_left, bisect_right
def ns(): return stdin.readline().rstrip()
def ni(): return int(ns())
def na(): return list(map(int, stdin.readline().split()))
def main():
n = ni()
a = na()
b = na()
c = na()
a... | p03557 |
def isOK(array, index, key):
if array[index] > key:
return True
else:
return False
def binary_serch(array, key):
ng = -1
ok = len(array)
while (abs(ok - ng) > 1):
mid = (ok + ng)//2
if isOK(array, mid, key):
ok = mid
else:
... | def isOK_under(array, index, key):
if array[index] >= key:
return True
else:
return False
def isOK_over(array, index, key):
if array[index] > key:
return True
else:
return False
def binary_serch_under(array, key):
ng = -1
ok = len(array)
whi... | p03557 |
n=int(eval(input()))
a,b,c=[list(map(int,input().split())) for _ in [0]*3]
from itertools import accumulate
a.sort()
b.sort()
c.sort()
a+=[10**20]
b+=[10**20]
p,q=0,0
cnt=0
ans=[0]*n
for i in range(n):
for j in range(p,n+1):
if b[i]>a[j]:
pass
else:
break
ans[i]=j
p=j
ans=[0]+list(accu... | n=int(eval(input()))
a,b,c=[list(map(int,input().split())) for _ in [0]*3]
from itertools import accumulate
a.sort()
b.sort()
c.sort()
a+=[10**20]
b+=[10**20]
p,q=0,0
cnt=0
ans=[0]*n
for i in range(n):
for j in range(p,n+1):
if b[i]>a[j]:
pass
else:
break
... | p03557 |
from bisect import bisect_left
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
B.sort()
C.sort()
# print(A)
# print(B)
# print(C)
A_B = []
for i in range(n):
A_B.append(bisect_left(A, B[i]))
ruiseki... | from bisect import bisect_left, bisect_right
n = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
C.sort()
ans = 0
for i in range(n):
ans += bisect_left(A, B[i]) * (n - bisect_right(C, B[i]))
print(ans)
| p03557 |
N = int(eval(input()))
A = list(map(int,input().split()))
B = list(map(int,input().split()))
C = list(map(int,input().split()))
A.sort()
B.sort()
C.sort()
BClist = []
for i in range(N):
for j in range(N):
if(B[i] < C[j]):
BClist.append(N-j)
break
ans = 0
for k in ... | import bisect
n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
ans = 0
a.sort()
b.sort()
c.sort()
for j in range(n):
ans += bisect.bisect_left(a,b[j])*(n-bisect.bisect_right(c,b[j]))
print(ans) | p03557 |
import bisect
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
cnt = 0
for j in range(N):
target = B[j]
insert_indexA = bisect.bisect_left(A, target)
insert_indexC = bisect.bisect_right(C, target)
... | import bisect
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = sorted(list(map(int, input().split())))
cnt = 0
for j in range(N):
target = B[j]
insert_indexA = bisect.bisect_left(A, target)
insert_indexC = bisect.bisect_right(C, target)
... | p03557 |
import bisect
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
j=bisect.bisect_left(b,a[i]+1)
if j>=n:
break
for k in range(j,n):
l=bisect.bisect_left(c,b[k]+1)
if ... | import bisect
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
a.sort()
b.sort()
c.sort()
ans=0
for i in range(n):
j=bisect.bisect_left(a,b[i])
k=n-bisect.bisect_right(c,b[i])
ans+=j*k
print(ans) | p03557 |
import sys
input = sys.stdin.readline
n=int(eval(input()))
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
ans=0
bfla=0
cfla=0
for i in range(n):
x=a[i]
bfla=0
cfla=0
for j in range(bfla,n):
if b[... | import sys
import bisect
input = sys.stdin.readline
n=int(eval(input()))
a = sorted(list(map(int, input().split())))
b = sorted(list(map(int, input().split())))
c = sorted(list(map(int, input().split())))
ans=0
for j in range(n):
al=bisect.bisect_left(a,b[j])
cl=n-bisect.bisect_right(c,b[j])
... | p03557 |
N = int(eval(input()))
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
C = [int(c) for c in input().split()]
A_sorted = sorted(A)
B_sorted = sorted(B)
C_sorted = sorted(C)
ans = 0
for b in B_sorted:
#Aのうちbより小さいの数
left = -1
right = N
while right - left > 1:
... | import bisect
N = int(eval(input()))
A = [int(a) for a in input().split()]
B = [int(b) for b in input().split()]
C = [int(c) for c in input().split()]
A_sorted = sorted(A)
B_sorted = sorted(B)
C_sorted = sorted(C)
ans = 0
for b in B_sorted:
#Aのうちbより小さいの数
a_count = bisect.bisect_left(A_sorted, b)
... | p03557 |
from collections import Counter
def altar(a,b):
cnt = 0
for k in range(len(b)):
while a and a[0][0]<b[k][0]:
cnt += a.pop(0)[1]
b[k] = (b[k][0],b[k][1]*cnt)
eval(input())
a,b,c = [sorted(list(dict(Counter(list(map(int,input().split())))).items()),key=lambda x:x[0])for _ in... | import bisect
n=int(eval(input()))
a,b,c = [sorted(map(int,input().split())) for _ in "abc"]
print((sum([bisect.bisect_left(a,x)*(n-bisect.bisect_right(c,x)) for x in b]))) | p03557 |
import bisect
n = int(eval(input()))
aa = list(sorted(map(int, input().split())))
bb = list(sorted(map(int, input().split())))
cc = list(sorted(map(int, input().split())))
ans = 0
for a in aa:
bi = bisect.bisect(bb, a)
bx = len(bb) - bi
for b in range(bi, len(bb)):
ci = bisect.bisect(c... | import bisect
n = int(eval(input()))
aa = list(sorted(map(int, input().split())))
bb = list(sorted(map(int, input().split())))
cc = list(sorted(map(int, input().split())))
ans = 0
for b in bb:
ax = bisect.bisect_left(aa, b)
ci = bisect.bisect(cc, b)
cx = len(cc) - ci
ans += ax * cx
print(... | p03557 |
import copy
n =int(eval(input()))
a=[]
b=[]
c=[]
a =list(map(int,input().split()))
a.sort()
b =list(map(int,input().split()))
b.sort()
c =list(map(int,input().split()))
c.sort()
c2 = copy.copy(c)
b_limit = 0
c_limit =0
count =0
c_count =0
b_score =[0]*n
for i in a:
c_count =0
c = copy.copy(... | import bisect
ans =0
n =int(eval(input()))
a =list(map(int,input().split()))
a.sort()
b =list(map(int,input().split()))
b.sort()
c =list(map(int,input().split()))
c.sort()
for i in b:
s = bisect.bisect_right(c,i)
s_num = n-s
t = bisect.bisect_left(a,i)
t_num = t
ans += s_num ... | p03557 |
N = int(eval(input()))
A = [int(i) for i in input().split()]
B = [int(i) for i in input().split()]
C = [int(i) for i in input().split()]
A.sort();C.sort()
M = 0
for i in range(N):
low = 0
high = N - 1
t = (low + high) // 2
if A[N-1] < B[i]:
t = N-1
elif A[0] >= B[i]:
t =... | from bisect import bisect_left,bisect_right
N=int(eval(input()))
A=[int(i) for i in input().split()]
B=[int(i) for i in input().split()]
C=[int(i) for i in input().split()]
A.sort()
C.sort()
ans=0
for i in range(N):
ans+=bisect_left(A,B[i])*(N-bisect_right(C,B[i]))
print(ans)
| p03557 |
from bisect import bisect_left,bisect_right;N=int(eval(input()));A=sorted([int(i) for i in input().split()]);B=[int(i) for i in input().split()];C=sorted([int(i) for i in input().split()]);ans=0
for i in range(N):ans+=bisect_left(A,B[i])*(N-bisect_right(C,B[i]))
print(ans)
| from bisect import bisect_left,bisect_right;N=int(eval(input()));A=sorted([int(i) for i in input().split()]);B=[int(i) for i in input().split()];C=sorted([int(i) for i in input().split()]);print((sum([bisect_left(A,B[i])*(N-bisect_right(C,B[i])) for i in range(N)]))) | p03557 |
from bisect import bisect_left,bisect_right;N=int(eval(input()));A,B,C=[list(map(int,input().split())) for _ in "ABC"];A.sort();C.sort();print((sum([bisect_left(A,B[i])*(N-bisect_right(C,B[i])) for i in range(N)]))) | from bisect import bisect_left,bisect_right;N=int(eval(input()));A,B,C=[list(map(int,input().split())) for _ in "ABC"];A.sort();C.sort();print((sum([bisect_left(A,i)*(N-bisect_right(C,i)) for i in B]))) | p03557 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.