Exemple #1
0
        public static void Main(string[] args)
        {
            TextWriter textWriter = new StreamWriter(@System.Environment.GetEnvironmentVariable("OUTPUT_PATH"), true);

            string[] firstMultipleInput = Console.ReadLine().TrimEnd().Split(' ');

            int n = Convert.ToInt32(firstMultipleInput[0]);

            int q = Convert.ToInt32(firstMultipleInput[1]);

            List <string> lines = new List <string>();

            for (int i = 0; i < q; i++)
            {
                lines.Add(Console.ReadLine());
            }

            var queries = InputConverter.ConvertToQueries(lines);

            List <int> result = Result.dynamicArray(n, queries);

            textWriter.WriteLine(String.Join("\n", result));

            textWriter.Flush();
            textWriter.Close();
        }
        public void Example1()
        {
            var n     = 2;
            var input = new [] {
                "1 0 5",
                "1 1 7",
                "1 0 3",
                "2 1 0",
                "2 1 1"
            };
            var expected = new [] { 7, 3 };

            var queries = InputConverter.ConvertToQueries(input);

            var result = Result.dynamicArray(n, queries);

            Assert.Equal(expected, result);
        }