Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Ununion_lists
- {
- class Program
- {
- static void Main(string[] args)
- {
- List<int> primal = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- int n = int.Parse(Console.ReadLine());
- int count = 0;
- while (count < n)
- {
- List<int> current = Console.ReadLine().Split(' ').Select(int.Parse).ToList();
- count++;
- foreach (int number in current)
- {
- if (!primal.Contains(number))
- {
- primal.Add(number);
- }
- else
- {
- primal.RemoveAll(a => a == number);
- }
- }
- }
- primal.Sort();
- Console.WriteLine(string.Join(" ", primal));
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement