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()))
a.sort()
b.sort()
c.sort()
c.reverse()
#print(a)
#print(b)
#print(c)
pat=0
ikeep=-1
for i in range(n):
x=b[i]
if(x!=ikeep):
ikeep=x
else:
pat+=paty*patz
continue
... | 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()
#print(a)
#print(b)
#print(c)
pat=0
ikeep=-1
for i in range(n):
x=b[i]
if(x!=ikeep):
ikeep=x
else:
pat+=paty*patz
continue... | p03557 |
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()
b.sort()
c.sort()
ans=0
for i in range(n):
for j in range(n):
if a[i]>=b[j]:
continue
else:
... | 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()
b.sort()
c.sort()
ans=0
for i in range(n):
A=bisect_left(a,b[i])
C=n-bisect_right(c,b[i])
ans+=A*C
print(ans)
| p03557 |
import itertools
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 i in range(0,len(c)):
b_index=bisect.bisect_left(b,c[-i-1])
for u in range(b_index):
cnt+=bisect.bisec... | import itertools
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 i in range(0,len(b)):
a_index = bisect.bisect_left(a,b[i])
c_index = bisect.bisect_right(c,b[i])
cnt+=a_in... | p03557 |
import sys
import itertools
# import numpy as np
import time
import math
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(eval(input()))
A = list(sorted(map(int, input... | import sys
import itertools
# import numpy as np
import time
import math
sys.setrecursionlimit(10 ** 7)
from collections import defaultdict
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
N = int(eval(input()))
A = list(sorted(map(int, input... | p03557 |
from bisect import bisect_left
N = int(eval(input()))
A = sorted(list(map(int, input().split())))
B = sorted(list(map(int, input().split())))
C = list(map(int, input().split()))
ans = 0
for c in C:
max_index_B = bisect_left(B, c)
for i in range(max_index_B):
ans += bisect_left(A, B[i])
p... | from bisect import bisect_left, bisect_right
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 b in B:
max_index_A = bisect_left(A, b)
max_index_C = N - bisect_right(C, b)
ans += (max_in... | p03557 |
n = int(eval(input()))
a = sorted(map(int, input().split()))
b = sorted(map(int, input().split()))
c = sorted(map(int, input().split()))
import bisect
ans = 0
for i in b:
A = bisect.bisect_left(a, i)
C = n - bisect.bisect_right(c, i)
ans += A * C
print(ans) | 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())))
import bisect
ans = 0
for bi in b:
a_cnt = bisect.bisect_left(a, bi)
c_cnt = N - bisect.bisect_right(c, bi)
ans += a_cnt * c_cnt
#print(a... | p03557 |
import bisect as bi
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):
for j in range(bi.bisect_left(B,C[i])):
ans+=bi.bisect_left(A,B[j])
print(ans) | import bisect as bi
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 Bi in B:
a=bi.bisect_left(A,Bi)
c=N-bi.bisect_right(C,Bi)
ans+=a*c
print(ans) | p03557 |
N=int(eval(input()))
s=sorted(list(map(int,input().split())))
t=sorted(list(map(int,input().split())),reverse=True)
u=sorted(list(map(int,input().split())),reverse=True)
ans=0
for j in range(N):
tt=[]
for k in range(N):
if s[j]<t[k]:
tt.append(t[k])
else:
break... | 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 b:
aa=bisect.bisect_left(a,i)
cc=N-bisect.bisect_right(c,i)
ans+=aa*cc
print(ans) | 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())))
ans=0
for i in b:
aa=bisect.bisect_left(a,i)
cc=N-bisect.bisect_right(c,i)
ans+=aa*cc
print(ans) | import bisect
N=int(eval(input()))
s=[list(sorted(map(int,input().split()))) for i in range(3)]
t=[]
q=0
for i in s[1]:
t.append(N-bisect.bisect_right(s[2],i))
for i in range(N):
q+=bisect.bisect_left(s[0],s[1][i])*t[i]
print(q) | p03557 |
from bisect import bisect_left
N = int(eval(input()))
upper = sorted(list(map(int, input().split())))
middle = sorted(list(map(int, input().split())))
lower = list(map(int, input().split()))
ans = 0
for l in lower:
idx = bisect_left(middle, l)
if idx>=1:
for m in middle[:idx]:
id... | from bisect import bisect_left, bisect_right
N = int(eval(input()))
upper = sorted(list(map(int, input().split())))
middle = list(map(int, input().split()))
lower = sorted(list(map(int, input().split())))
ans = 0
for m in middle:
idx_u = bisect_left(upper, m)
idx_l = N-bisect_right(lower, m)
ans ... | p03557 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""077-c"""
import sys
import pprint
import re
import itertools
pp = pprint.PrettyPrinter(indent=2)
def main():
"""Main function."""
N = int(eval(input()))
As = sorted(list(map(int, input().split(' '))))
Bs = sorted(list(map(int, input... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""077-c"""
import sys
import pprint
import re
import itertools
import bisect
pp = pprint.PrettyPrinter(indent=2)
def main():
"""Main function."""
N = int(eval(input()))
As = sorted(list(map(int, input().split(' '))))
Bs = list(map(... | p03557 |
from bisect import bisect
import random
def binary_search(L, n, i, j):
# print(L, n, i, j)
low = i
high = j
while low <= high:
mid = (low + high) //2
guess = L[mid]
# if guess == n:
# return mid
if guess > n:
high = mid -1
... | from bisect import bisect_left, bisect_right
# import random
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
# N = 10 ** 5
# A = [random.randint(1, 10**9) for _ in range(N)]
# B = [random.randint(1, 10**9) for _ in range(N)]
... | p03557 |
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())))
cnt = [0] * N
for i in range(N):
cnt[i] = N - bisect_right(C, B[i])
res = 0
for i in range(N):
idx = bise... | 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())))
cnt = [0] * N
for i in range(N):
cnt[i] = N - bisect_right(C, B[i])
cumsum = [0] * (N + 1)
for i in range(N):
... | p03557 |
def main():
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()
bb = [0 for _ in range(N)]
for i,b in enumerate(B):
for c in C[::-1]:
if c > b:... | def main():
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
Ai = -1
Ci = -1
for i in range(N):
if Ai<N-1:
while A[Ai+1]<B... | p03557 |
# def binary_search(lst):
# pass
import bisect
n = int(eval(input()))
lst_A = list(map(int, input().split()))
lst_B = list(map(int, input().split()))
lst_C = list(map(int, input().split()))
lst_A.sort()
lst_B.sort()
lst_C.sort()
ans = 0
for b in lst_B:
ia = bisect.bisect_left(lst_A, b)
... | import bisect
n = int(eval(input()))
lst_A = list(map(int, input().split()))
lst_B = list(map(int, input().split()))
lst_C = list(map(int, input().split()))
lst_A.sort()
lst_B.sort()
lst_C.sort()
ans = 0
for b in lst_B:
na = bisect.bisect_left(lst_A, b)
nc = n - bisect.bisect_right(lst_C, b)
... | p03557 |
import bisect
n = int(eval(input()))
lst_A = list(map(int, input().split()))
lst_B = list(map(int, input().split()))
lst_C = list(map(int, input().split()))
lst_A.sort()
lst_B.sort()
lst_C.sort()
ans = 0
for b in lst_B:
na = bisect.bisect_left(lst_A, b)
nc = n - bisect.bisect_right(lst_C, b)
... | from bisect import bisect_left, bisect_right
n = int(eval(input()))
lst_A = sorted(map(int, input().split()))
lst_B = sorted(map(int, input().split()))
lst_C = sorted(map(int, input().split()))
ans = 0
for b in lst_B:
na = bisect_left(lst_A, b)
nc = n - bisect_right(lst_C, b)
ans += na * nc... | 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())))
Clen = len(C)
total = 0
for i in A:
Bmin = bisect.bisect_right(B, i)
for j in B[Bmin :]:
total += Clen - bisect.bisec... | 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())))
total = 0
for b in B:
i = N - bisect.bisect_right(C, b)
j = bisect.bisect_left(A, b)
total += i * j
print(total) | 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()
Bcon = [0] * N
res = 0
p = 0
for n in range(N):
while p <= N - 1 and B[n] > A[p]:
p += 1
Bcon[n] = p
p = 0
for n in range(N):
... | 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()
Bcon = [0] * (N + 1)
res = 0
p = 0
for n in range(N):
while p <= N - 1 and B[n] > A[p]:
p += 1
Bcon[n + 1] = p + Bcon[n]
p =... | p03557 |
from bisect import bisect
from itertools import accumulate
def main():
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()
ainb = [bisect(b, ea) for ea in a]
bc = [n -... | import sys
read = sys.stdin.read
#readlines = sys.stdin.readlines
from bisect import bisect, bisect_left
from itertools import accumulate
def main():
data = list(map(int, read().split()))
n = data[0]
a = data[1:n + 1]
b = data[n + 1: n * 2 + 1]
c = data[n * 2 + 1:]
a.sort()
b.sor... | p03557 |
#ABC077C
N=int(eval(input()))
#大きい順に# 並べる
A=sorted(list(map(int,input().split())), reverse=True)
B=sorted(list(map(int,input().split())), reverse=True)
C=sorted(list(map(int,input().split())), reverse=True)
#あるBの下にいくつCが入るか数える
C_under_B=[0]*N #i番目のBの下に入るCの数
for i in range(N):
if i > 0:
if B[i] ... | #ABC077C 解説を見て自作
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())))
#あるBの下にいくつCが入るか数える
C_under_B=[0]*N #i番目のBの下に入るCの数
for i in range(N):
C_under_B[i]=N-bisect.bisect_right(C,B[i])
#あるBの上にいくつAが乗るか... | 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):
b = bisect.bisect(B,A[i])
for j in range(b,n):
c = bisect.bisect(C,B[j])
count ... | 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):
a = bisect.bisect_left(A,B[i])
c = bisect.bisect_right(C,B[i])
count += a*(n-c)
pri... | p03557 |
import bisect
n = int(eval(input()))
al = sorted(list(map(int, input().split())))
bl = sorted(list(map(int, input().split())))
cl = sorted(list(map(int, input().split())))
a_len = len(al)
b_len = len(bl)
c_len = len(cl)
ans = 0
for a in al:
b_index = bisect.bisect_right(bl, a)
if b_index >= b_l... | import bisect
n = int(eval(input()))
al = sorted(list(map(int, input().split())))
bl = sorted(list(map(int, input().split())))
cl = sorted(list(map(int, input().split())))
ans = 0
for b in bl:
i = bisect.bisect_left(al, b)
j = bisect.bisect_right(cl, b)
ans += i*(n-j)
print(ans) | p03557 |
# coding:UTF-8
import sys
from math import factorial
MOD = 10 ** 9 + 7
INF = 10000000000
def binary_search_section(list, min, max):
low = 0
high = len(list) - 1
upper = len(list)
lower = -1
while low <= high:
mid = (low + high) // 2
guess = list[mid]
if guess... | # coding:UTF-8
import sys
from math import factorial
MOD = 10 ** 9 + 7
INF = 10000000000
def binary_search_section(list, min, max):
low = 0
high = len(list) - 1
upper = len(list)
lower = -1
while low <= high:
mid = (low + high) // 2
guess = list[mid]
if guess... | 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 a in A:
i = bisect.bisect_right(B, a)
for b in B[i:]:
j = bisect.bisect_right(C, b)
ans += n-j
print(ans) | 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 b in B:
a_ind = bisect.bisect_left(A, b)
c_ind = bisect.bisect_right(C, b)
ans += a_ind*(n-c_ind)
print(ans) | p03557 |
def main():
n = int(eval(input()))
a = [int(s) for s in input().split()]
b = [int(s) for s in input().split()]
c = [int(s) for s in input().split()]
print((solve(n, a, b, c)))
def solve(n, a, b, c):
d = [c, b, a]
dp = []
dp.append([1 for _ in range(n)])
dp.append([0 for _... | import bisect
def main():
n = int(eval(input()))
a = sorted([int(s) for s in input().split()])
b = sorted([int(s) for s in input().split()])
c = sorted([int(s) for s in input().split()])
print((solve(n, a, b, c)))
def solve(n, a, b, c):
d = [c, b, a]
dp = []
dp.append([n - ... | p03557 |
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())))
"""
minnum以上で最小の数のindexを返す。無いときはlen(List)を返す
計算量log(len(List))
def bts(List,minnum,under=0):
if List[0]>=minnum:
return under
if List[... | 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:
ac=bisect.bisect_right(al,b-1)
cc=n-bisect.bisect_left(cl,b+1)
ans+=ac*cc
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())))
neo_b = [[] for _ in range(n)]
ans = 0
for i in range(n):
neo_b[i] = bisect.bisect_left(a,b[i])
for i in range(n):
ans += sum(neo_b[:bisect.... | 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 range(n):
ans += bisect.bisect_left(a,b[i])*(n-bisect.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()))
ans = 0
for a in A:
for b in B:
for c in C:
if a < b < c:
ans += 1
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 n in range(N):
i = bisect.bisect_left(A,B[n])
j = len(C) - bisect.bisect_right(C,B[n])
ans += i * j
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()
bans = []
last = 0
for bi in range(n):
bnow = b[bi]
for ci in range(last,n):
if c[ci] > bnow:
bans.append([bnow,n-ci])
last = ci
... | #解説より二分探索
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()
bans = []
for bi in range(n):
bnow = b[bi]
here = bisect.bisect_right(c,bnow)
bans.append([bnow,n-here])
bsun = 0
for bi... | p03557 |
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())))
def check_a(a_num, b_num):
res = False
if a_num < b_num:
res = True
return res
def check_c(c_num, b_num):
res = False
if b... | n = int(eval(input()))
a = list(map(int, input().split()))
b = list(map(int, input().split()))
c = list(map(int, input().split()))
cnt = [0] * len(b)
a = sorted(a)
c = sorted(c)
for i in range(len(b)):
target = b[i]
# decide a cnt
l = 0
r = len(a) - 1
if a[l] >= target:
cn... | 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(" "))))
count = 0
for i in b:
#print((a[:bisect.bisect(a, i - 1)]), i, c[bisect.bisect_left(c, i + 1):])
count += len(a[:bisect.bis... | 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(" "))))
count = 0
for i in b:
#print((a[:bisect.bisect_right(a, i - 1)]), i, c[bisect.bisect_left(c, i + 1):])
#print(bisect.bisect_right(a... | p03557 |
#!/usr/bin python3
# -*- coding: utf-8 -*-
from bisect import bisect_left, bisect_right
def main():
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()
ret = 0
... | #!/usr/bin python3
# -*- coding: utf-8 -*-
from bisect import bisect_left, bisect_right
def main():
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()
ret = 0
... | p03557 |
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
counter = 0
for a in A:
for b in B:
if a < b:
for c in C:
if b < c:
counter = counter + 1
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 = sorted(A)
C = sorted(C)
counter = 0
for k in range(N):
i = bisect.bisect_left(A, B[k])
j = N - bisect.bisect_right(C, B[k])
counter += i * j... | 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()
b=b[::-1]
c.sort()
ans=tmp=0
for i in a:
for j in b:
if i>=j: break
tmp=bisect.bisect_right(c, j)
ans+=(n-tmp)
print... | 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()
b=b[::-1]
c.sort()
ans=tmp=0
for i in b:
x=bisect.bisect_left(a,i)
y=bisect.bisect_right(c, i)
ans+=x*(n-y)
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()))
al=sorted(a)
bl=sorted(b)
cl=sorted(c)
abl=[]
i=0
for j in range(n):
i=n-1
while al[i]>=bl[j]:
i-=1
if i==-1:
break
if i==-1:
abl.app... | n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
al=sorted(a)
bl=sorted(b)
cl=sorted(c)
abl=[0]*n
bcl=[0]*n
i=n-1
for j in range(n-1,-1,-1):
if i==-1:
abl[j]=0
continue
while al[i]>=bl[j]:
i-=1
... | p03557 |
def main():
from bisect import bisect_left
n, *abc = list(map(int, open(0).read().split()))
a, b, c = abc[:n], abc[n:2 * n], abc[2 * n:]
a, b, c = sorted(a), sorted(b), sorted(c)
ans = 0
for i in c:
j = bisect_left(b, i)
for k in b[:j]:
l = bisect_left(a, k)
... | def main():
from bisect import bisect_left, bisect_right
n, *abc = list(map(int, open(0).read().split()))
a, b, c = abc[:n], abc[n:2 * n], abc[2 * n:]
a, b, c = sorted(a), sorted(b), sorted(c)
ans = 0
for i in b:
j = bisect_left(a, i)
k = n - bisect_right(c, i)
a... | 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()
AtoB=[0 for i in range(n)]
BtoC=[0 for i in range(n+1)]
for i in range(n):
top=a[i]
h=n
l=-1
while h-l>1:
mid=(h+l)//2
if b[mid]>top:
h... | 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):
middle=b[i]
h=n
l=-1
while h-l>1:
m=(h+l)//2
if a[m]<middle:
l=m
else:
h=m
ab=l+1
h=n
l=-1... | p03557 |
N = int(eval(input()))
a = []
for i in range(3):
a.append(list(map(int, input().split())))
for i in range(3):
a[i].sort()
dataa = []
datab = []
memo = 0
for i in range(N):
flag = 0
for j in range(memo, N):
if a[0][i] < a[1][j]:
memo = j
dataa.append(N - ... | N = int(eval(input()))
a = []
for i in range(3):
a.append(list(map(int, input().split())))
for i in range(3):
a[i].sort()
dataa = []
datab = []
memo = 0
#print(a)
for i in range(N):
flag = 0
for j in range(memo, N):
#print(a[0][i], a[1][j])
if a[0][i] < a[1][j]:
... | p03557 |
import bisect
num = int(eval(input()))
top = sorted([int(x) for x in input().split()])
middle = sorted([int(x) for x in input().split()])
bottom = sorted([int(x) for x in input().split()])
res = 0
for i in top:
index = bisect.bisect_right(middle, i)
if index != len(middle):
for j in middl... | import bisect
num = int(eval(input()))
top = sorted([int(x) for x in input().split()])
middle = sorted([int(x) for x in input().split()])
bottom = sorted([int(x) for x in input().split()])
# middleの配列でループを回したほうが早い(topとbottomを同時に処理できるため)
res = 0
for i in middle:
index = bisect.bisect_left(top, i)
... | p03557 |
import bisect
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()])
res = 0
for cc in c:
b_res = bisect.bisect_left(b, cc)
for bb in b[:b_res]:
res += (bisect.bisect_left(a, bb))
... | import bisect
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()])
res = 0
for bb in b:
b_res = bisect.bisect_left(a, bb)
c_res = len(c) - bisect.bisect_right(c, bb)
res += (b_res*c_res... | p03557 |
# C - Snuke Festival
N = int(eval(input()))
A = list(int(x) for x in input().split())
B = list(int(x) for x in input().split())
C = list(int(x) for x in input().split())
B.sort()
C.sort()
def binarySearch(a, b):
l = -1
r = N
while l+1<r:
m = (l+r)//2
if a[m]<=b:
... | # C - Snuke Festival
N = int(eval(input()))
A = list(int(x) for x in input().split())
B = list(int(x) for x in input().split())
C = list(int(x) for x in input().split())
A.sort()
C.sort()
def binarySearchLeft(a, b):
l = -1
r = N
while l+1<r:
m = (l+r)//2
if a[m]<b:
... | p03557 |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from bisect import bisect_left
def main():
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 c... | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from bisect import bisect_left, bisect_right
def main():
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 ... | p03557 |
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
ans=[]
ans_2=[]
for i in range(n):
cnt=0
for j in range(n):
if a[j]<b[i]:
cnt+=1
ans.append(cnt)
for i in range(n):
cnt_2=0
for j in range(n):
... | n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
import bisect
a.sort()
c.sort()
cl=len(c)
cnt=0
for i in b:
x=bisect.bisect_left(a,i)
y=bisect.bisect_right(c,i)
cnt+=x*(cl-y)
print(cnt)
| p03557 |
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
import bisect
a.sort()
c.sort()
cl=len(c)
cnt=0
for i in b:
x=bisect.bisect_left(a,i)
y=bisect.bisect_right(c,i)
cnt+=x*(cl-y)
print(cnt)
| n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
import bisect
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 |
n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
import bisect
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)
| n=int(eval(input()))
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
import bisect
ans=0
a.sort()
b.sort()
c.sort()
for i in range(n):
lift=bisect.bisect_left(a,b[i])
right=bisect.bisect_right(c,b[i])
right=n-right
ans+=lift*right
print(an... | p03557 |
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())))
import bisect
ans = 0
for i in a:
comb = 1
index = bisect.bisect_right(b,i)
for j in b[index:]:
ans += n-bisect.bisect_right(c,j)
print(a... | 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())))
import bisect
ans = 0
cnt = []
for i in b:
cnt.append(n-bisect.bisect_right(c,i))
cnt += [0]
for i in range(n-1,-1,-1):
cnt[i] += cnt[i+1]
for i in ... | p03557 |
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.append(10 ** 10)
B.append(10 ** 10)
C.append(10 ** 10)
A.sort()
B.sort()
C.sort()
i, j, k = 0, 0, 0
count = 0
total = []
result = 0
while i < N:
while C[i] > B[... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.append(10 ** 10)
B.append(10 ** 10)
C.append(10 ** 10)
A.sort()
B.sort()
C.sort()
i, j, k = 0, 0, 0
count = 0
total = 0
result = 0
while i < N:
while C[i] > B[j... | 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()
def binsearch(threshold, lst):
left, right = -1, len(lst)
while right - left > 1:
mid = (left + right) // 2
if lst[mid] > thr... | 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 binsearch(threshold, lst):
left, right = -1, len(lst)
while right - left > 1:
mid = (left + right) // 2
if lst[mid] > thr... | p03557 |
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
t = 0
ans = 0
u =[0]*n
d =[0]*n
for i in range(n):
for j in range(n):
if b[i]>a[j]:
t+=1
u[i]=t
t=0
for i in range(n):
for j in range(n):
... | n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
t = 0
ans = 0
u =[0]*n
d =[0]*n
a2 =[]
b2 =[]
c2 =[]
for i in range(n):
a2.append([2,a[i]])
for i in range(n):
b2.append([1,b[i]])
for i in range(n):
c2.append([0... | p03557 |
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
t = 0
ans = 0
u =[0]*n
d =[0]*n
a2 =[]
b2 =[]
c2 =[]
for i in range(n):
a2.append([2,a[i]])
for i in range(n):
b2.append([1,b[i]])
for i in range(n):
c2.append([0... | 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 n_smaller_a(num):
if num>a[n-1]:
return n
if num<=a[0]:
return 0
left=0
right=n-1
mid=(left+right)//2
... | p03557 |
n = int(eval(input()))
al = list(map(int, input().split()))
bl = list(map(int, input().split()))
cl = list(map(int, input().split()))
al = sorted(al)
bl = sorted(bl)
cl = sorted(cl)
total = 0
for alnum in al:
truebl = [blnum for blnum in bl if blnum > alnum]
for blnum in truebl:
total += su... | # C
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 = sorted(al)
bl = sorted(bl)
cl = sorted(cl)
total = 0
for blnum in bl:
alcnt = bisect.bisect_left(al, blnum)
clcnt = n - bisect.bisect_right(c... | p03557 |
from bisect import bisect_right,bisect_left
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):
na=bisect_left(a,b[i])
nc=bisect_right(c,b[i])
ans+=na*(n-nc)
print(ans) | 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()
b.sort()
c.sort()
ans=0
for i in range(n):
indea=bisect_left(a,b[i])
indec=bisect_right(c,b[i])
ans+=indea*(n-indec)
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())))
count = 0
for a in A:
b = bisect.bisect_left(B,a+1)
if b == N:
continue
for i in range(b,N):
c = bisect.bisect_left... | 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())))
count = 0
for b in B:
a = bisect.bisect_left(A,b)
c = bisect.bisect_right(C,b)
count += a*(N-c)
print(count) | p03557 |
import bisect as bi
def main():
from builtins import input, int, map
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):
a = bi.bisect_left(A,B[i])
c = len(C... | import bisect as bi
def main():
from builtins import input, int, map
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):
a = bi.bisect_left(A,B[i])
c = N-bi.... | p03557 |
def low_left(ls,key):
left,right = -1,len(ls)
while right - left > 1:
mid = (right+left)//2
if ls[mid] >= key:
right = mid
else:
left = mid
return len(ls[:(left+1)])
def high_right(ls,key):
left,right = -1,len(ls)
while right - left > 1:... | def low_left(ls,key):
left,right = -1,len(ls)
while right - left > 1:
mid = (right+left)//2
if ls[mid] >= key:
right = mid
else:
left = mid
return left+1
def high_right(ls,key):
left,right = -1,len(ls)
while right - left > 1:
mi... | p03557 |
from bisect import bisect_right
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
B.sort()
C.sort()
ans = 0
for a in A:
b_index = bisect_right(B, a)
if b_index == len(B):
continue
b_cnt = len(B)-b_index
... | 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()
ans = 0
for i in range(N):
a_cnt = bisect.bisect_left(A, B[i])
c_cnt = N-bisect.bisect_right(C, B[i])
ans += a_cnt*c_cnt
print(an... | p03557 |
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()))
count = 0
#for i in range(n):
#for s in range(bisect.bisect_right(b, a[i]),n):
#count += n-bisect.bisect_right(c, b[s])
for i in itertools.produc... | 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 |
#!/usr/bin/env python3
#ABC77 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()
ans = 0
for i in a:
s = 0
x = bisect.bisect_right(b,i)
for j in b[x:]:
y = bisect.... | #!/usr/bin/env python3
#ABC77 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()
ans = 0
for i in b:
x = bisect.bisect_left(a,i)
y = bisect.bisect_right(c,i)
ans += x*(n-y)... | p03557 |
import sys
from bisect import bisect_right, bisect_left
from functools import reduce
readline = sys.stdin.buffer.readline
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def lcm_base(x, y):
return (x * y) // gcd(x, y)
def lcm_list(numbers):
return reduce(lcm_base, numbers, 1)
... | import sys
read = sys.stdin.read
readline = sys.stdin.buffer.readline
from bisect import bisect_right, bisect_left
sys.setrecursionlimit(10 ** 8)
INF = float('inf')
MOD = 10 ** 9 + 7
def main():
N = int(readline())
A = list(map(int, readline().split()))
B = list(map(int, readline().split()))
... | p03557 |
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()
B += [10 ** 9 + 1] + [0] # B[-1] = 0, B[N] = 10**9 + 1となるようにする
C += [10 ** 9 + 1] + [0] # C[-1] = 0, C[N] = 10**9 + 1となるようにする
# For each ... | 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 j in range(N):
i = bisect.bisect_left(A, B[j])
k = bisect.bisect_right(C, B[j])
ans += i * (N - k)
... | p03557 |
import bisect
def main():
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()))
ans = 0
b_list.sort()
c_list.sort()
for i in range(n):
tob_insert_num = a_list[i]
... | import bisect
def main():
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()))
ans = 0
a_list.sort()
c_list.sort()
for i in range(n):
toa_insert_index = bisect.bisect_le... | p03557 |
# -*- coding: utf-8 -*-
import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations_count(n, r):
return math.factorial(n) // math.factorial(n - r)
N = int(eval(input()))
An = list(map(int, input().split()))
Bn = list(map(int, inp... | # -*- coding: utf-8 -*-
import math
def combinations_count(n, r):
return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
def permutations_count(n, r):
return math.factorial(n) // math.factorial(n - r)
N = int(eval(input()))
An = list(map(int, input().split()))
Bn = list(map(int, inp... | p03557 |
import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#from bisect import insort_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(inp... | import sys
input=sys.stdin.readline
#from collections import defaultdict
#d = defaultdict(int)
#import fractions
#import math
#import collections
#from collections import deque
#from bisect import bisect_left
#from bisect import insort_left
#N = int(input())
#A = list(map(int,input().split()))
#S = list(inp... | p03557 |
N = int(eval(input()))
A = list(map(int, input().split(" ")))
B = list(map(int, input().split(" ")))
C = list(map(int, input().split(" ")))
m = 0
A.sort()
B.sort()
C.sort(reverse=True)
for j in B:
for i in range(N):
if A[i] >= j:
break
if A[N-1] < j:
i = N
... | 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()
C.reverse()
ans = 0
ai = 0
ci = N-1
for b in B:
while ai < N and A[ai] < b:
ai += 1
while ci >= 0 and C[ci] <= b:
ci ... | p03557 |
import bisect
N=int(eval(input()))
alist=list(map(int,input().split()))
blist=list(map(int,input().split()))
clist=list(map(int,input().split()))
alist.sort()
blist.sort()
clist.sort()
answer=0
for bi in range(N):
ai=bisect.bisect_left(alist,blist[bi])
ci=bisect.bisect(clist,blist[bi])
#print(ai... | import bisect
N=int(eval(input()))
alist=list(map(int,input().split()))
blist=list(map(int,input().split()))
clist=list(map(int,input().split()))
alist.sort()
blist.sort()
clist.sort()
answer=0
ai,ci=0,0
for bi in range(N):
while(ai<N and alist[ai]<blist[bi]):
ai+=1
while(ci<N and blist[bi]>=clis... | 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()]
A2=sorted(A)
B2=sorted(B)
C2=sorted(C)
ans = 0
sum = 0
t =0
b = 0
for i in range(N):
a = A2[i]
low = 0
high = N-1
while True:
t = (low + high) ... | N = int(eval(input()))
A = list(int(i) for i in input().split())
B = list(int(i) for i in input().split())
C = list(int(i) for i in input().split())
A.sort()
B.sort()
C.sort()
sum = 0
for j in range(N):
low = low2 = 0
high = high2 = N
b = B[j]
mid = mid2 = 0
#print(b)
while(high>lo... | p03557 |
import bisect as bis
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):
top = a[i]
for j in range(n):
mid = b[j]
if top >= mid:
continue
... | import bisect as bis
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_e in b:
n_top = bis.bisect_left(a, b_e)
n_bottom = n - bis.bisect_right(c, b_e)
ans += n_top * n_bottom
... | p03557 |
#!/usr/bin/env python3
def main():
from bisect import bisect
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()])
lst = [N - bisect(C, b) for b in B]
ans = 0
for a in ... | #!/usr/bin/env python3
def main():
from bisect import bisect
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()])
lst = [N - bisect(C, b) for b in B]
lst = lst[::-1]
t... | p03557 |
#!/usr/bin/env python3
def main():
from bisect import bisect
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()])
lst = [N - bisect(C, b) for b in B]
lst = lst[::-1]
t... | #!/usr/bin/env python3
def main():
from bisect import bisect, bisect_left
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()])
print((sum([bisect_left(A, b) * (N - bisect(C, b))... | 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(reverse=True)
# B.sort(reverse=True)
# C.sort(reverse=True)
# C.append(-1)
a_count = [0 for i in range(N)]
b_count = [0 for i in range(N)]
# i, j = 0, 0
# while i < N:
... | N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)
c_cnt = [1 for i in range(N)]
def count(A, B, b_cnt):
B.append(-1)
a_cnt = [0 for i in range(N)]
i, j... | p03557 |
from bisect import bisect_right
import sys
input = sys.stdin.readline
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 i in range(N):
a = A[i]
bb = bisect_right(B, a)
... | from bisect import bisect_right, bisect_left
import sys
input = sys.stdin.readline
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 j in range(N):
b = B[j]
i = bisect_left(A, b)
... | p03557 |
import bisect
eval(input())
A=[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 a in A:
for b in B[bisect.bisect_right(B,a):]:
ans+=len(C[bisect.bisect_right(C,b):])
print(ans) | 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:
ans+=bisect.bisect_left(A,b)*(N-bisect.bisect_right(C,b))
print(ans) | p03557 |
# -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__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())))
count = 0
# See:
# https://img.atcoder.... | # -*- coding: utf-8 -*-
# AtCoder Beginner Contest
# Problem C
if __name__ == '__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())))
count = 0
# See:
# https://img.atcoder.... | p03557 |
# -*- coding: utf-8 -*-
def main():
from bisect import bisect_left
from bisect import bisect_right
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 bi in b:
... | # -*- coding: utf-8 -*-
def main():
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())))
ans = 0
for bi in... | 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())))
A_B = []
B_C = []
total = 0
for a in A:
k = bisect.bisect_right(B, a)
l = N - k
A_B.append(l)
for b in B:
k = bise... | 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())))
A_B = []
B_C = []
total = 0
for b in B:
k = bisect.bisect_left(A,b)
l = bisect.bisect_right(C,b)
total += k * (N-l)
pri... | p03557 |
#!/usr/bin/python
# AtCoder Beginner Contest 077
# C - Snuke Festival
from sys import stdin
def solve(As, Bs, Cs):
# Bs :: [(b, # of bottom parts > b)]
Bs = [(b, sum([1 for c in Cs if c > b])) for b in Bs]
# As :: [# of mid & bottom parts > a]
As = [sum([b[1] for b in Bs if b[0] > a]) for ... | #!/usr/bin/python
# AtCoder Beginner Contest 077
# C - Snuke Festival
from sys import stdin
def solve(As, Bs, Cs):
As.sort()
Bs.sort()
Cs.sort()
# Bs :: [(b, # of bottom parts > b)]
# Bs = [(b, sum([1 for c in Cs if c > b])) for b in Bs]
j = 0
for i in range(len(Bs)):
... | p03557 |
import bisect
import sys
def input(): return sys.stdin.readline().strip()
def I(): return int(eval(input()))
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return eval(i... | import bisect
import sys
def input(): return sys.stdin.readline().strip()
def I(): return int(eval(input()))
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return eval(i... | 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):
up = A[i]
middleIndex = bisect.bisect(B, up)
if middleIndex < N:
for j in range(mi... | 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()))
A.sort()
B.sort()
C.sort()
ans = 0
dp = [0] * N
for i in range(N):
up = A[i]
middleIndex = bisect.bisect(B, up)
if middleIndex... | p03557 |
N = int(eval(input()))
A = list(map(int, input().split()))
#A = [int(x) for x in input().split()]
B = list(map(int, input().split()))
C = list(map(int, input().split()))
A.sort()
A = [-float('inf')] + A + [float('inf')]
B.sort()
C.sort()
C = [-float('inf')] + C + [float('inf')]
total = 0
for i in range(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 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()))
A.sort()
B.sort()
C.sort()
total = 0
for i in range(N):
low1 = 0
high = N
while low1 < high:
mid = (low1 + high) // 2
if A[mid] < B[i]:
... | 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)-1 for i in input().split()])
def bis(x,y):
low = 0
high = N
while low < high:
mid = (low + high) // 2
if x[mid] < y:
low = mid + 1
el... | p03557 |
import bisect
def find_ge(a, x):
i = bisect.bisect_right(a,x)
return i
def solve(n, a, b, c):
b_count = [0]*len(b)
for i, x in enumerate(b):
b_count[i] = len(c) - find_ge(c, x)
ans = 0
for i in a:
x = find_ge(b, i)
ans += sum(b_count[x:])
... | import bisect
import itertools
def find_ge(a, x):
i = bisect.bisect_right(a,x)
return i
def solve(n, a, b, c):
tmp = len(c)
b_count =list(itertools.accumulate([tmp - find_ge(c, x) for x in b]))
ans = 0
for i in a:
min_index = find_ge(b, i)
ans += b_count[... | 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())))
BDP = [-1] * N
ans = 0
for a in A:
b_idx = bisect.bisect_right(B, a)
for i in range(b_idx,N):
if BDP[i] == -1:
... | 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 b in B:
ans += bisect.bisect_left(A, b) * (N - bisect.bisect_right(C, b))
print(ans)
| p03557 |
n = int(eval(input()))
a = list([int(x) for x in input().split()])
b = list([int(x) for x in input().split()])
c = list([int(x) for x in input().split()])
count = 0
for mid in b:
upper_count = len(list([x for x in a if x<mid]))
lower_count = len(list([x for x in c if x>mid]))
count += upper_count ... | import bisect
n = int(eval(input()))
a = sorted(list([int(x) for x in input().split()]))
b = sorted(list([int(x) for x in input().split()]))
c = sorted(list([int(x) for x in input().split()]))
count = 0
for mid in b:
upper_count = bisect.bisect_left(a,mid)
lower_count = len(c) - bisect.bisect_right(... | 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()))
b.sort()
c.sort()
ans = 0
for i in range(n):
pos = 0
for j in range(bisect.bisect_right(b,a[i]),n):
while (pos < n and c[pos] <= b[j]):
po... | 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()
ans = 0
for i in range(n):
ans += bisect.bisect_left(a,b[i])*(n-bisect.bisect_right(c,b[i]))
print(ans) | p03557 |
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:
x, y = 0, 0
for j in A:
if j < i:
x += 1
else:
break
for j in reversed(C):
... | 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:
ans += bisect.bisect_left(A,i)*(N-bisect.bisect_right(C,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()))
b.append(0)
c.append(0)
a.sort()
b.sort()
c.sort()
def isok(na , index , key):
if na[index] >= key:
return True
else:
return False
def bs(nar,key)... | 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 isok(na , index , key):
if na[index] >= key:
return True
else:
return False
def bs(nar,key):
left = -1
righ... | p03557 |
import sys
def input(): return sys.stdin.readline().rstrip()
def main():
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 b in B:
sum_v = 1
l = -1
r = N
... | import sys
import bisect
def input(): return sys.stdin.readline().rstrip()
def main():
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 b in B:
ans += bisect.bisect_left(A, b... | p03557 |
n = int(eval(input()))
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))
num = 0
for i in range(n):
for j in range(n):
for k in range(n):
if a[i] < b[j] < c[k]:
num += 1
print(num) | 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(a,b,c)
cnt = 0
for i in range(n):
d = bisect.bisect_left(a,b[i])
e = bisect.bisect_right(c,b[i])
cnt += d*(n-e)
print(cnt) | p03557 |
import sys
import collections
# import math
# import string
# import bisect
def main():
n, *parts = (int(x) for x in sys.stdin.read().split())
uppers, middles, lowers = (parts[n*i:n*(i+1)] for i in range(3))
count = 0
for a, ca in list(collections.Counter(uppers).items()):
for b,... |
import sys
# import collections
# import math
# import string
import bisect
def main():
n, *parts = (int(x) for x in sys.stdin.read().split())
uppers, middles, lowers = (parts[n*i:n*(i+1)] for i in range(3))
uppers.sort()
lowers.sort()
count = 0
for j in middles:
i = bi... | p03557 |
import sys
from bisect import bisect_left as bi_l, bisect_right as bi_r
n = int(sys.stdin.readline().rstrip())
*a, = list(map(int, sys.stdin.readline().split()))
*b, = list(map(int, sys.stdin.readline().split()))
*c, = list(map(int, sys.stdin.readline().split()))
def main():
a.sort()
b.sort()
c... | import sys
from bisect import bisect_left as bi_l, bisect_right as bi_r
n = int(sys.stdin.readline().rstrip())
a = sorted(map(int, sys.stdin.readline().split()))
b = sorted(map(int, sys.stdin.readline().split()))
c = sorted(map(int, sys.stdin.readline().split()))
def main():
combs = 0
for x in b:
... | 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())))
D=[0]*N
E=[0]*N
for i in range(N):
D[i]=N-bisect.bisect_right(C,B[i])
for i in range(N):
E[i]=sum(D[bisect.bisect_right(B,A[i]):])
print((su... | 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 range(N):
ans+=(bisect.bisect_left(A,B[i]))*(N-bisect.bisect_right(C,B[i]))
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())))
second = []
third = []
ans = 0
for i in range(N):
second.append(N - bisect.bisect_right(B,A[i]))
third.append(N - bisect.bisect_right(C,B[i]... | 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):
ans += bisect.bisect_left(A,B[i]) * (N - bisect.bisect_right(C,B[i]))
print(ans) | p03557 |
from bisect import *
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):
for j in range(bisect_right(b,a[i]),n):
ans+=n-bisect_right(c,b[j])
print(ans) | from bisect import *
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):
x=bisect_left(a,b[i])
y=n-bisect_right(c,b[i])
ans+=x*y
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()))
bika=[0]
cika=[0]
j=0
k=0
a.sort()
b.sort()
c.sort()
for i in range(n):
if j<n:
while a[j]<b[i]:
bika[i]+=1
j+=1
if j>=n:
break
if i!=n-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()
c.sort()
ans=0
for i in b:
x=bisect.bisect_left(a,i)
y=n-bisect.bisect_right(c,i)
ans+=x*y
print(ans) | p03557 |
import copy
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()
p = 0
c.sort()
q = 0
count = 0
x = 0
for i in range(n):
p = 0
q = 0
while p<n:
if (b[p] > a[i]):
while q<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):
x = bisect.bisect_left(a,b[i])
y = bisect.bisect_right(c,b[i])
ans += x*(n-y)
print(ans) | p03557 |
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
#Bの中の数iに対して、Aの中でiより小さい数の個数と、Cの中でiより大きい数の個数の積を探索
for i in B:
ans += bisect_right(A, i-0.1) * (N-b... | 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()
# print (A, B ,C)
ans = 0
for i in B:
# print (i)
# print (bisect.bisect_left(A, i-0.1))
ans += bisect.bisect_left(A,... | p03557 |
N = int(eval(input()))
def binary_search(L, target):
"""
>>> binary_search([1,3,5],2)
2
>>> binary_search([1,3,5],5)
0
>>> binary_search([1,3,5],9)
0
>>> binary_search([1,3,3,3,3,5],3)
1
>>> binary_search([1,3,3,3,3,5],4)
1
"""
if L[0] > target:
... | 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 hoge():
count = 0
Ai = -1
Ci = -1
for i in range(N):
if Ai < N - 1:
while A[Ai + 1] < B[i]:
... | p03557 |
import sys
from bisect import bisect_left, bisect, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
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())))
... | import sys
from bisect import bisect_left, bisect_right
input = sys.stdin.readline
sys.setrecursionlimit(10 ** 7)
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())))
cnt ... | p03557 |
import itertools
N = int(eval(input()))
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))
L = list(itertools.product(A,B,C,repeat=1))
cnt = 0
for i,j,k in L:
if i<j<k:
cnt += 1
print(cnt) | 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 x in B:
# 小さい
sm = bisect.bisect_left(A,x)
# 大きい
bi = len(C) - bisect.bisect_right(C,x)
ans += sm*bi... | 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 a:
for j in range(bisect.bisect(b, i), len(b)):
count += len(b) - bisect.bisect(c, b[j])
print(count)
| 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 b:
count += bisect.bisect_left(a, i) * (len(c) - bisect.bisect(c, i))
print(count)
| p03557 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.