using System.Collections.Generic; using System; public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var m = int.Parse(line[1]); var k = int.Parse(line[2]); line = Console.ReadLine().Trim().Split(' '); var op = line[0]; var a = new int[m]; for (int i = 0; i < m; i++) a[i] = int.Parse(line[i + 1]); var b = new int[n]; for (int i = 0; i < n; i++) b[i] = int.Parse(Console.ReadLine().Trim()); Array.Sort(b); var ans = 0L; for (int i = 0; i < m; i++) { int t; if (op == "+") t = k - a[i]; else t = (a[i] + k - 1) / a[i]; var w = LowerBound(b, t); ans += n - w; } Console.WriteLine(ans); } public static int LowerBound(T[] arr, int start, int end, T value, IComparer comparer) { int low = start; int high = end; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (comparer.Compare(arr[mid], value) < 0) low = mid + 1; else high = mid; } return low; } public static int LowerBound(T[] arr, T value) where T : IComparable => LowerBound(arr, 0, arr.Length, value, Comparer.Default); }