using LeetCode.Utilses;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace LeetCode.QuestionBank.Question0018
{
    public class Test0018
    {
        public void Test()
        {
            Interface0018 solution = new Solution0018_3();
            int[] nums; int target;
            IList<IList<int>> result, answer;
            int id = 0;

            nums = new int[] { 1, 0, -1, 0, -2, 2 }; target = 0;
            answer = new List<IList<int>>() { new List<int>() { -2, -1, 1, 2 }, new List<int>() { -2, 0, 0, 2 }, new List<int>() { -1, 0, 0, 1 } };
            result = solution.FourSum(nums, target);
            Console.WriteLine($"{++id,2}: {Utils.CompareArray(result, answer) + ",",-6} result: {Utils.ToString(result)}, answer: {Utils.ToString(answer)}");

            nums = new int[] { 2, 2, 2, 2, 2 }; target = 8;
            answer = new List<IList<int>>() { new List<int>() { 2, 2, 2, 2 } };
            result = solution.FourSum(nums, target);
            Console.WriteLine($"{++id,2}: {Utils.CompareArray(result, answer) + ",",-6} result: {Utils.ToString(result)}, answer: {Utils.ToString(answer)}");

            nums = new int[] { 2, 2 }; target = 8;
            answer = new List<IList<int>>() { };
            result = solution.FourSum(nums, target);
            Console.WriteLine($"{++id,2}: {Utils.CompareArray(result, answer) + ",",-6} result: {Utils.ToString(result)}, answer: {Utils.ToString(answer)}");

            nums = new int[] { 1000000000, 1000000000, 1000000000, 1000000000 }; target = -294967296;     // 防止溢出测试
            answer = new List<IList<int>>() { };
            result = solution.FourSum(nums, target);
            Console.WriteLine($"{++id,2}: {Utils.CompareArray(result, answer) + ",",-6} result: {Utils.ToString(result)}, answer: {Utils.ToString(answer)}");

            nums = new int[] { -1000000000, -1000000000, -1000000000, -1000000000 }; target = 294967296;  // 防止溢出测试
            answer = new List<IList<int>>() { };
            result = solution.FourSum(nums, target);
            Console.WriteLine($"{++id,2}: {Utils.CompareArray(result, answer) + ",",-6} result: {Utils.ToString(result)}, answer: {Utils.ToString(answer)}");

            nums = new int[] { 1000000000, 1000000000, 1000000000, 1000000000, -1000000000, -1000000000, -1000000000, -1000000000 }; target = 0;  // 防止溢出测试
            answer = new List<IList<int>>() { new List<int>() { -1000000000, -1000000000, 1000000000, 1000000000 } };
            result = solution.FourSum(nums, target);
            Console.WriteLine($"{++id,2}: {Utils.CompareArray(result, answer) + ",",-6} result: {Utils.ToString(result)}, answer: {Utils.ToString(answer)}");

            nums = new int[] { 0, 0, 0, 1000000000, 1000000000, 1000000000, 1000000000 }; target = 1000000000;
            answer = new List<IList<int>>() { new List<int>() { 0, 0, 0, 1000000000 } };
            result = solution.FourSum(nums, target);
            Console.WriteLine($"{++id,2}: {Utils.CompareArray(result, answer) + ",",-6} result: {Utils.ToString(result)}, answer: {Utils.ToString(answer)}");

            nums = new int[] { 1, 0, -1, 0, -2, 2, 1, 2, 34, 45, 3, 4, 5, 6, -3, -4, -5, 23, 12, 7, 8, 9, -9, -8, -7, -6, -10, 10 }; target = 8;
            answer = new List<IList<int>>() { new List<int>() { -10, -9, -7, 34 }, new List<int>() { -10, -9, 4, 23 }, new List<int>() { -10, -8, 3, 23 }, new List<int>() { -10, -7, 2, 23 }, new List<int>() { -10, -6, 1, 23 }, new List<int>() { -10, -5, 0, 23 }, new List<int>() { -10, -4, -1, 23 }, new List<int>() { -10, -4, 10, 12 }, new List<int>() { -10, -3, -2, 23 }, new List<int>() { -10, -3, 9, 12 }, new List<int>() { -10, -2, 8, 12 }, new List<int>() { -10, -1, 7, 12 }, new List<int>() { -10, -1, 9, 10 }, new List<int>() { -10, 0, 6, 12 }, new List<int>() { -10, 0, 8, 10 }, new List<int>() { -10, 1, 5, 12 }, new List<int>() { -10, 1, 7, 10 }, new List<int>() { -10, 1, 8, 9 }, new List<int>() { -10, 2, 4, 12 }, new List<int>() { -10, 2, 6, 10 }, new List<int>() { -10, 2, 7, 9 }, new List<int>() { -10, 3, 5, 10 }, new List<int>() { -10, 3, 6, 9 }, new List<int>() { -10, 3, 7, 8 }, new List<int>() { -10, 4, 5, 9 }, new List<int>() { -10, 4, 6, 8 }, new List<int>() { -10, 5, 6, 7 }, new List<int>() { -9, -8, 2, 23 }, new List<int>() { -9, -7, 1, 23 }, new List<int>() { -9, -6, 0, 23 }, new List<int>() { -9, -5, -1, 23 }, new List<int>() { -9, -5, 10, 12 }, new List<int>() { -9, -4, -2, 23 }, new List<int>() { -9, -4, 9, 12 }, new List<int>() { -9, -3, 8, 12 }, new List<int>() { -9, -2, 7, 12 }, new List<int>() { -9, -2, 9, 10 }, new List<int>() { -9, -1, 6, 12 }, new List<int>() { -9, -1, 8, 10 }, new List<int>() { -9, 0, 5, 12 }, new List<int>() { -9, 0, 7, 10 }, new List<int>() { -9, 0, 8, 9 }, new List<int>() { -9, 1, 4, 12 }, new List<int>() { -9, 1, 6, 10 }, new List<int>() { -9, 1, 7, 9 }, new List<int>() { -9, 2, 3, 12 }, new List<int>() { -9, 2, 5, 10 }, new List<int>() { -9, 2, 6, 9 }, new List<int>() { -9, 2, 7, 8 }, new List<int>() { -9, 3, 4, 10 }, new List<int>() { -9, 3, 5, 9 }, new List<int>() { -9, 3, 6, 8 }, new List<int>() { -9, 4, 5, 8 }, new List<int>() { -9, 4, 6, 7 }, new List<int>() { -8, -7, 0, 23 }, new List<int>() { -8, -6, -1, 23 }, new List<int>() { -8, -6, 10, 12 }, new List<int>() { -8, -5, -2, 23 }, new List<int>() { -8, -5, 9, 12 }, new List<int>() { -8, -4, -3, 23 }, new List<int>() { -8, -4, 8, 12 }, new List<int>() { -8, -3, 7, 12 }, new List<int>() { -8, -3, 9, 10 }, new List<int>() { -8, -2, 6, 12 }, new List<int>() { -8, -2, 8, 10 }, new List<int>() { -8, -1, 5, 12 }, new List<int>() { -8, -1, 7, 10 }, new List<int>() { -8, -1, 8, 9 }, new List<int>() { -8, 0, 4, 12 }, new List<int>() { -8, 0, 6, 10 }, new List<int>() { -8, 0, 7, 9 }, new List<int>() { -8, 1, 3, 12 }, new List<int>() { -8, 1, 5, 10 }, new List<int>() { -8, 1, 6, 9 }, new List<int>() { -8, 1, 7, 8 }, new List<int>() { -8, 2, 2, 12 }, new List<int>() { -8, 2, 4, 10 }, new List<int>() { -8, 2, 5, 9 }, new List<int>() { -8, 2, 6, 8 }, new List<int>() { -8, 3, 4, 9 }, new List<int>() { -8, 3, 5, 8 }, new List<int>() { -8, 3, 6, 7 }, new List<int>() { -8, 4, 5, 7 }, new List<int>() { -7, -6, -2, 23 }, new List<int>() { -7, -6, 9, 12 }, new List<int>() { -7, -5, -3, 23 }, new List<int>() { -7, -5, 8, 12 }, new List<int>() { -7, -4, 7, 12 }, new List<int>() { -7, -4, 9, 10 }, new List<int>() { -7, -3, 6, 12 }, new List<int>() { -7, -3, 8, 10 }, new List<int>() { -7, -2, 5, 12 }, new List<int>() { -7, -2, 7, 10 }, new List<int>() { -7, -2, 8, 9 }, new List<int>() { -7, -1, 4, 12 }, new List<int>() { -7, -1, 6, 10 }, new List<int>() { -7, -1, 7, 9 }, new List<int>() { -7, 0, 3, 12 }, new List<int>() { -7, 0, 5, 10 }, new List<int>() { -7, 0, 6, 9 }, new List<int>() { -7, 0, 7, 8 }, new List<int>() { -7, 1, 2, 12 }, new List<int>() { -7, 1, 4, 10 }, new List<int>() { -7, 1, 5, 9 }, new List<int>() { -7, 1, 6, 8 }, new List<int>() { -7, 2, 3, 10 }, new List<int>() { -7, 2, 4, 9 }, new List<int>() { -7, 2, 5, 8 }, new List<int>() { -7, 2, 6, 7 }, new List<int>() { -7, 3, 4, 8 }, new List<int>() { -7, 3, 5, 7 }, new List<int>() { -7, 4, 5, 6 }, new List<int>() { -6, -5, -4, 23 }, new List<int>() { -6, -5, 7, 12 }, new List<int>() { -6, -5, 9, 10 }, new List<int>() { -6, -4, 6, 12 }, new List<int>() { -6, -4, 8, 10 }, new List<int>() { -6, -3, 5, 12 }, new List<int>() { -6, -3, 7, 10 }, new List<int>() { -6, -3, 8, 9 }, new List<int>() { -6, -2, 4, 12 }, new List<int>() { -6, -2, 6, 10 }, new List<int>() { -6, -2, 7, 9 }, new List<int>() { -6, -1, 3, 12 }, new List<int>() { -6, -1, 5, 10 }, new List<int>() { -6, -1, 6, 9 }, new List<int>() { -6, -1, 7, 8 }, new List<int>() { -6, 0, 2, 12 }, new List<int>() { -6, 0, 4, 10 }, new List<int>() { -6, 0, 5, 9 }, new List<int>() { -6, 0, 6, 8 }, new List<int>() { -6, 1, 1, 12 }, new List<int>() { -6, 1, 3, 10 }, new List<int>() { -6, 1, 4, 9 }, new List<int>() { -6, 1, 5, 8 }, new List<int>() { -6, 1, 6, 7 }, new List<int>() { -6, 2, 2, 10 }, new List<int>() { -6, 2, 3, 9 }, new List<int>() { -6, 2, 4, 8 }, new List<int>() { -6, 2, 5, 7 }, new List<int>() { -6, 3, 4, 7 }, new List<int>() { -6, 3, 5, 6 }, new List<int>() { -5, -4, 5, 12 }, new List<int>() { -5, -4, 7, 10 }, new List<int>() { -5, -4, 8, 9 }, new List<int>() { -5, -3, 4, 12 }, new List<int>() { -5, -3, 6, 10 }, new List<int>() { -5, -3, 7, 9 }, new List<int>() { -5, -2, 3, 12 }, new List<int>() { -5, -2, 5, 10 }, new List<int>() { -5, -2, 6, 9 }, new List<int>() { -5, -2, 7, 8 }, new List<int>() { -5, -1, 2, 12 }, new List<int>() { -5, -1, 4, 10 }, new List<int>() { -5, -1, 5, 9 }, new List<int>() { -5, -1, 6, 8 }, new List<int>() { -5, 0, 1, 12 }, new List<int>() { -5, 0, 3, 10 }, new List<int>() { -5, 0, 4, 9 }, new List<int>() { -5, 0, 5, 8 }, new List<int>() { -5, 0, 6, 7 }, new List<int>() { -5, 1, 2, 10 }, new List<int>() { -5, 1, 3, 9 }, new List<int>() { -5, 1, 4, 8 }, new List<int>() { -5, 1, 5, 7 }, new List<int>() { -5, 2, 2, 9 }, new List<int>() { -5, 2, 3, 8 }, new List<int>() { -5, 2, 4, 7 }, new List<int>() { -5, 2, 5, 6 }, new List<int>() { -5, 3, 4, 6 }, new List<int>() { -4, -3, 3, 12 }, new List<int>() { -4, -3, 5, 10 }, new List<int>() { -4, -3, 6, 9 }, new List<int>() { -4, -3, 7, 8 }, new List<int>() { -4, -2, 2, 12 }, new List<int>() { -4, -2, 4, 10 }, new List<int>() { -4, -2, 5, 9 }, new List<int>() { -4, -2, 6, 8 }, new List<int>() { -4, -1, 1, 12 }, new List<int>() { -4, -1, 3, 10 }, new List<int>() { -4, -1, 4, 9 }, new List<int>() { -4, -1, 5, 8 }, new List<int>() { -4, -1, 6, 7 }, new List<int>() { -4, 0, 0, 12 }, new List<int>() { -4, 0, 2, 10 }, new List<int>() { -4, 0, 3, 9 }, new List<int>() { -4, 0, 4, 8 }, new List<int>() { -4, 0, 5, 7 }, new List<int>() { -4, 1, 1, 10 }, new List<int>() { -4, 1, 2, 9 }, new List<int>() { -4, 1, 3, 8 }, new List<int>() { -4, 1, 4, 7 }, new List<int>() { -4, 1, 5, 6 }, new List<int>() { -4, 2, 2, 8 }, new List<int>() { -4, 2, 3, 7 }, new List<int>() { -4, 2, 4, 6 }, new List<int>() { -4, 3, 4, 5 }, new List<int>() { -3, -2, 1, 12 }, new List<int>() { -3, -2, 3, 10 }, new List<int>() { -3, -2, 4, 9 }, new List<int>() { -3, -2, 5, 8 }, new List<int>() { -3, -2, 6, 7 }, new List<int>() { -3, -1, 0, 12 }, new List<int>() { -3, -1, 2, 10 }, new List<int>() { -3, -1, 3, 9 }, new List<int>() { -3, -1, 4, 8 }, new List<int>() { -3, -1, 5, 7 }, new List<int>() { -3, 0, 1, 10 }, new List<int>() { -3, 0, 2, 9 }, new List<int>() { -3, 0, 3, 8 }, new List<int>() { -3, 0, 4, 7 }, new List<int>() { -3, 0, 5, 6 }, new List<int>() { -3, 1, 1, 9 }, new List<int>() { -3, 1, 2, 8 }, new List<int>() { -3, 1, 3, 7 }, new List<int>() { -3, 1, 4, 6 }, new List<int>() { -3, 2, 2, 7 }, new List<int>() { -3, 2, 3, 6 }, new List<int>() { -3, 2, 4, 5 }, new List<int>() { -2, -1, 1, 10 }, new List<int>() { -2, -1, 2, 9 }, new List<int>() { -2, -1, 3, 8 }, new List<int>() { -2, -1, 4, 7 }, new List<int>() { -2, -1, 5, 6 }, new List<int>() { -2, 0, 0, 10 }, new List<int>() { -2, 0, 1, 9 }, new List<int>() { -2, 0, 2, 8 }, new List<int>() { -2, 0, 3, 7 }, new List<int>() { -2, 0, 4, 6 }, new List<int>() { -2, 1, 1, 8 }, new List<int>() { -2, 1, 2, 7 }, new List<int>() { -2, 1, 3, 6 }, new List<int>() { -2, 1, 4, 5 }, new List<int>() { -2, 2, 2, 6 }, new List<int>() { -2, 2, 3, 5 }, new List<int>() { -1, 0, 0, 9 }, new List<int>() { -1, 0, 1, 8 }, new List<int>() { -1, 0, 2, 7 }, new List<int>() { -1, 0, 3, 6 }, new List<int>() { -1, 0, 4, 5 }, new List<int>() { -1, 1, 1, 7 }, new List<int>() { -1, 1, 2, 6 }, new List<int>() { -1, 1, 3, 5 }, new List<int>() { -1, 2, 2, 5 }, new List<int>() { -1, 2, 3, 4 }, new List<int>() { 0, 0, 1, 7 }, new List<int>() { 0, 0, 2, 6 }, new List<int>() { 0, 0, 3, 5 }, new List<int>() { 0, 1, 1, 6 }, new List<int>() { 0, 1, 2, 5 }, new List<int>() { 0, 1, 3, 4 }, new List<int>() { 0, 2, 2, 4 }, new List<int>() { 1, 1, 2, 4 }, new List<int>() { 1, 2, 2, 3 } };
            result = solution.FourSum(nums, target);
            // Console.WriteLine($"{++id,2}: {Utils.CompareArray(result, answer) + ",",-6}, result: {Utils.ArrayToString(result)}, answer: {Utils.ArrayToString(answer)}");
            Console.WriteLine($"{++id,2}: {Utils.CompareArray(result, answer) + ",",-6}, result: {"... ..."}, answer: {"... ..."}");
        }
    }
}
