using System; using System.Collections.Generic; using System.Linq; class Program { static void Main(string[] args) { // 入力 var N = int.Parse(Console.ReadLine()); var a = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList(); var b = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToList(); // スコア計算 int myScore = 0; int otherScore = 0; for (int i=0; i < N; i++) { if (b[i] == 0) myScore += a[i]; if (b[i] == 1) otherScore += a[i]; } Console.WriteLine("oh->{0} : my->{1} | max->{2} : min->{3}", otherScore, myScore, a.Max(), a.Min()); // 出力 Console.WriteLine(( myScore >= otherScore && myScore >= a.Max()) ? "YES" : "NO"); } }