示例#1
0
def main(argv):
    assert len(argv) == 2

    api = CodeforcesAPI()

    print('Loading your submissions')
    handle = argv[1]
    submissions = filter_accepted(api.user_status(handle))
    solved_problems = {submission.problem for submission in submissions}
    print('Loaded {} solved problems'.format(len(solved_problems)))

    print('Loading contests...')
    contests = group_by_contest_id(filter_div2(api.contest_list()))

    print('Loaded {} Div.2 contests'.format(len(contests)))

    print('Loading problemset...')
    problemset = api.problemset_problems()

    stats = problemset['problemStatistics']
    stats = filter_c(stats)
    stats = filter(lambda s: s.contest_id in contests, stats)
    stats = sorted(stats, key=lambda s: s.solved_count, reverse=True)

    problems = group_by_contest_id(filter_c(problemset['problems']))

    print()
    print('{:30}{:10}{:15}{}'.format('Name', 'Is solved', 'Solved count', 'Url'))

    for stat in stats[:10]:
        problem = problems[stat.contest_id][0]
        print('{:30}{!s:10}{:<15}{}'.format(problem.name,
                                            problem in solved_problems,
                                            stat.solved_count,
                                            make_url(problem)))
示例#2
0
def main(argv):
    assert len(argv) == 2

    api = CodeforcesAPI()

    print('Loading your submissions')
    handle = argv[1]
    submissions = filter_accepted(api.user_status(handle))
    solved_problems = filter_c(submission.problem for submission in submissions)
    solved_problems = set(solved_problems)
    six.print_(('Loaded {} solved C problems'.format(len(solved_problems))))

    print('Loading contests...')
    contests = group_by_contest_id(filter_div2(api.contest_list()))

    six.print_(('Loaded {} Div.2 contests'.format(len(contests))))

    print('Loading problemset...')
    problemset = api.problemset_problems()

    problems = group_by_contest_id(filter_c(problemset['problems']))

    stats = problemset['problemStatistics']
    stats = filter_c(stats)
    stats = filter(lambda s: s.contest_id in contests, stats)
    stats = filter(lambda s: problems[s.contest_id][0] not in solved_problems, stats)
    stats = sorted(stats, key=lambda s: s.solved_count, reverse=True)


    print()
    six.print_(('{:30}{:15}{}'.format('Name', 'Solved count', 'Url')))

    for stat in stats[:10]:
        problem = problems[stat.contest_id][0]
        six.print_(('{:30}{:<15}{}'.format(problem.name, stat.solved_count, make_url(problem))))
示例#3
0
文件: utils.py 项目: DenVilk/newtab
def Contests():
    api = CodeforcesAPI()
    url = 'http://codeforces.com/contest/{}'
    answer = ""
    url_registration = 'http://codeforces.com/contestRegistration/{}'
    x = api.contest_list(False)
    answer = []
    for c in x:
        if (c.start_time > int(time.time())):
            answer.append({'name':c.name, 'date': time.ctime(c.start_time)})
    return answer