Example #1
0
        public static async Task BruteforceProblems()
        {
            var contestReq = new ContestListRequest();

            var contests = await contestReq.GetContestListAsync(includeGym : false);

            foreach (var contest in contests.Where(i => i.Phase == ContestPhase.FINISHED))
            {
                var req            = new ContestStandingsRequest();
                var contestDetails = await req.GetContestStandingsAsync(contestId : contest.Id, from : 1, count : 1);

                var contestProblems = contestDetails?.Problems;

                if (contestProblems == null)
                {
                    continue;
                }

                foreach (var problem in contestProblems)
                {
                    if (problem.Index == "C" && problem.Tags.Contains("fft"))
                    {
                        Console.WriteLine($"Found at ContestId: {problem.ContestId}");
                    }
                }
            }
            Console.WriteLine("Done!");
        }
Example #2
0
        public static async Task BuildGym()
        {
            var req     = new ContestListRequest();
            var gymList = await req.GetContestListAsync(true);

            Dictionary <int, List <Problem> > dic = new Dictionary <int, List <Problem> >();

            foreach (var contest in gymList)
            {
                var req2      = new ContestStandingsRequest();
                var standings = await req2.GetContestStandingsAsync(contest.Id, 1, 1);

                dic.Add(contest.Id, new List <Problem>());
                foreach (var problem in standings.Problems)
                {
                    dic[contest.Id].Add(problem);
                }
            }

            Console.WriteLine("Done");
            var properDic  = dic.ToDictionary(k => k.Key.ToString(), v => v.Value);
            var serializer = new JavaScriptSerializer().Serialize(properDic);

            File.WriteAllText("contests.json", serializer);
        }
Example #3
0
        public static async Task GetTopHacks()
        {
            var req       = new ContestStandingsRequest();
            var standings = await req.GetContestStandingsAsync(contestId : 1051, from : 1, count : 100000, showUnofficial : true);

            standings.Rows = standings.Rows.OrderByDescending(i => i.SucessfulHackCount)
                             .ThenByDescending(i => - i.UnSucessfulHackCount).ToList();

            for (int i = 0; i < 10; i++)
            {
                Console.WriteLine($"{standings.Rows[i].Party.Members[0].Handle} has +{standings.Rows[i].SucessfulHackCount} | -{standings.Rows[i].UnSucessfulHackCount}");
            }
        }
Example #4
0
        public static async void GetLegends()
        {
            var req      = new ContestListRequest();
            var contests = await req.GetContestListAsync();

            contests = contests.Where(i => i.Phase == ContestPhase.FINISHED).ToList();

            foreach (var contest in contests)
            {
                try
                {
                    var req2      = new ContestStandingsRequest();
                    var standings = await req2.GetContestStandingsAsync(contest.Id, 1, 1, null, 0, false);

                    var users = standings.Rows.FindAll(i => i.Rank == 1);
                    foreach (var user in users)
                    {
                        if (count.ContainsKey(user.Party.Members[0].Handle))
                        {
                            count[user.Party.Members[0].Handle]++;
                        }
                        else
                        {
                            count.Add(user.Party.Members[0].Handle, 1);
                        }
                    }
                    await Task.Delay(205);
                }
                catch { }
            }
            count = count.OrderByDescending(i => i.Value).ToDictionary(x => x.Key, x => x.Value);

            int ok = 0;

            foreach (var x in count)
            {
                Console.WriteLine($"{ok + 1}) {x.Key} has {x.Value} wins.");
                ok++;
                if (ok == 25)
                {
                    break;
                }
            }
        }