Advertisement
Guest User

Untitled

a guest
Aug 13th, 2021
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.12 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace Ranking_MoreEx
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. string[] input = Console.ReadLine().Split(":");
  12.  
  13. Dictionary<string, string> contest = new Dictionary<string, string>();
  14. Dictionary<string, Dictionary<string, int>> student = new Dictionary<string, Dictionary<string, int>>();
  15.  
  16. //C# Fundamentals=>fundPass=>Tanya=>350
  17.  
  18. while (input[0] != "end of contests")
  19. {
  20. if (!contest.ContainsKey(input[0]))
  21. {
  22. contest.Add(input[0], input[1]);
  23. }
  24.  
  25. input = Console.ReadLine().Split(":");
  26. }
  27.  
  28. string[] command = Console.ReadLine().Split("=>");
  29.  
  30. while (command[0] != "end of submissions")
  31. {
  32. if (contest.ContainsKey(command[0]) && contest[command[0]] == command[1])
  33. {
  34. if (!student.ContainsKey(command[2]))
  35. {
  36. student.Add(command[2], new Dictionary<string, int>());
  37.  
  38.  
  39. student[command[2]].Add(command[0], int.Parse(command[3]));
  40. }
  41. else
  42. {
  43. if (!student[command[2]].ContainsKey(command[0]))
  44. {
  45. student[command[2]].Add(command[0], int.Parse(command[3]));
  46. }
  47. else
  48. {
  49. if (student[command[2]][command[0]] < int.Parse(command[3]))
  50. {
  51. student[command[2]][command[0]] = int.Parse(command[3]);
  52. }
  53.  
  54. }
  55. }
  56. }
  57.  
  58. command = Console.ReadLine().Split("=>");
  59. }
  60.  
  61. //Console.WriteLine($"Best candidate is {student.Keys.Where(x => x)} with total {student.Values} points.");
  62. }
  63. }
  64. }
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement