Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- sing System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace UnunionList
- {
- class Program
- {
- static void Main()
- {
- List<int> numbers = Console.ReadLine().Split().Select(int.Parse).ToList();
- int n = int.Parse(Console.ReadLine());
- for (int i = 0; i < n; i++)
- {
- var list = Console.ReadLine().Split().Select(int.Parse).ToList();
- for (int j = 0; j < list.Count; j++)
- {
- if (numbers.Contains(list[j]))
- {
- numbers.RemoveAll(x => x == list[j]);
- }
- else
- {
- numbers.Add(list[j]);
- }
- }
- }
- numbers.Sort();
- Console.WriteLine(string.Join(" ", numbers));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement