Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace _04.FourthTask
- {
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- public class Program
- {
- public static void Main()
- {
- int n = int.Parse(Console.ReadLine());
- StringBuilder strB = new StringBuilder();
- Dictionary<int, HashSet<int>> dic = new Dictionary<int, HashSet<int>>();
- for (int i = 0; i < n; i++)
- {
- dic.Add(i, new HashSet<int>());
- string input = Console.ReadLine();
- if (input == "None")
- {
- dic[i].Add(-1);
- }
- else
- {
- int[] str = input.Split().Select(int.Parse).ToArray();
- foreach (int number in str)
- {
- dic[i].Add(number);
- }
- }
- }
- string inputT = Console.ReadLine();
- while (inputT != "Have a break")
- {
- int[] inputToN = inputT.Split().Select(int.Parse).ToArray();
- if (dic[inputToN[0]].Contains(inputToN[1]))
- {
- strB.AppendLine("There is a direct flight.");
- }
- else
- {
- strB.AppendLine("No flights available.");
- }
- inputT = Console.ReadLine();
- }
- Console.WriteLine(strB.ToString());
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement