Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- namespace Ranking_MoreEx
- {
- class Program
- {
- static void Main(string[] args)
- {
- string[] input = Console.ReadLine().Split(":");
- Dictionary<string, string> contest = new Dictionary<string, string>();
- Dictionary<string, Dictionary<string, int>> student = new Dictionary<string, Dictionary<string, int>>();
- //C# Fundamentals=>fundPass=>Tanya=>350
- while (input[0] != "end of contests")
- {
- if (!contest.ContainsKey(input[0]))
- {
- contest.Add(input[0], input[1]);
- }
- input = Console.ReadLine().Split(":");
- }
- string[] command = Console.ReadLine().Split("=>");
- while (command[0] != "end of submissions")
- {
- if (contest.ContainsKey(command[0]) && contest[command[0]] == command[1])
- {
- if (!student.ContainsKey(command[2]))
- {
- student.Add(command[2], new Dictionary<string, int>());
- student[command[2]].Add(command[0], int.Parse(command[3]));
- }
- else
- {
- if (!student[command[2]].ContainsKey(command[0]))
- {
- student[command[2]].Add(command[0], int.Parse(command[3]));
- }
- else
- {
- if (student[command[2]][command[0]] < int.Parse(command[3]))
- {
- student[command[2]][command[0]] = int.Parse(command[3]);
- }
- }
- }
- }
- command = Console.ReadLine().Split("=>");
- }
- //Console.WriteLine($"Best candidate is {student.Keys.Where(x => x)} with total {student.Values} points.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement