Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Judge
- {
- class Program
- {
- static void Main(string[] args)
- {
- //6 7 3 8 1 9 4 5 6 2 1 3
- int[] array = Console.ReadLine().Split(' ').Select(int.Parse).ToArray();
- List<int> firstList = new List<int>();
- List<int> secondsList = new List<int>();
- for(int i=0; i<array.Length-1;i++)
- {
- if(array[i]<array[i+1])
- {
- firstList.Add(array[i]);
- }
- else
- {
- firstList.Add(array[i]);
- if(firstList.Count>=secondsList.Count)
- {
- secondsList = firstList;
- }
- firstList = new List<int>();
- }
- }
- firstList.Add(array[array.Length - 1]);
- if(secondsList.Count==0)
- {
- Console.WriteLine(string.Join(" ",firstList));
- }
- else if(firstList.Count==secondsList.Count)
- {
- Console.WriteLine(string.Join(" ",firstList));
- }
- else
- {
- Console.WriteLine(string.Join(" ",secondsList));
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement