1.Ranking- More Exercises: Associative Arrays- corelation betwen values of two Dictionaries
I need some help for this exercise. If somebody have some spare time, could they, please check my print method at the end. I think my logic is correct, but I can't print each contest with the points in descending order, because the information from the another list becomes invalid.
I have two dictionaries: var usernamesListOfContests= new SortedDictionary<string, List<string>>() with username and all the contests per user and var usernamesListOfPoints= new Dictionary<string, List<int>>() with username and all points.
If I change the order in the second dictionary, the information in the first dictionary becomes invalid and incorrect. I need some corelation betwen those two lists when I try to sort and print the result. I'am not very confident to use dictionary from dictionaryies.
Thanks in advance.
https://softuni.bg/trainings/resources/officedocument/38560/more-exercise-technology-fundamentals-with-csharp-january-2019/2237
https://judge.softuni.bg/Contests/Practice/Index/1302#0
https://pastebin.com/7FLT6E0i - 40/100
Console.WriteLine("Ranking: ");
foreach (var kvp in usernamesListOfContests)
{
string username = kvp.Key;
Console.WriteLine($"{username}");
var listOfContest = kvp.Value;
var listOfPoints = usernamesListOfPoints[username];
for (int i = 0; i <listOfContest.Count() ; i++)
{
Console.WriteLine($"# {listOfContest[i]} -> {listOfPoints[i]}");
}
Axiomatic, thanks a lot.
It was not very complicated to use dictionary from dictionaries. :)
I would be tryng in the next exercise.
Best regards!