Example #1
0
def analyze_problem(problem_num):
    url = 'https://www.acmicpc.net/status/?'
    query = {
        'problem_id': problem_num,
        'user_id': user_id,
        'result_id': '4',
        'language_id': '-1',
        'from_mine': '1'
    }

    for k, v in query.items():
        url += k + '=' + v + '&'

    table = dict()

    page = get_soup(url, query)
    rows = page.find('tbody').find_all('tr')

    if len(rows) is 0:
        return table

    for row in rows:
        column = row.find_all('td')

        language = column[6].text.strip()

        length = None
        length_text = column[7].text.strip()
        if len(length_text) != 0:
            length = length_text.split()[0]

        element = SubmitRecord(judge_id=column[0].text,
                               mem=column[4].contents[0],
                               time=column[5].contents[0],
                               code_len=length)

        if table.get(language) is None:
            table[language] = element
        else:
            table[language] = min(table[language], element)

    problem_name = rows[0].find_all('td')[2].a['title']

    screenLock.acquire()
    print("{:5s} {}".format(problem_num, problem_name))
    for l, e in table.items():
        print("\t{:10s} {}".format(l, e))
    screenLock.release()

    return table
Example #2
0
def analyze_problem(problem_num):
    url = 'https://www.acmicpc.net/status/?'
    query = {'problem_id': problem_num, 'user_id': user_id, 'result_id': '4', 'language_id': '-1', 'from_mine': '1'}

    for k, v in query.items():
        url += k + '=' + v + '&'

    table = dict()

    page = get_soup(url, query)
    rows = page.find('tbody').find_all('tr')

    if len(rows) is 0:
        return table

    for row in rows:
        column = row.find_all('td')

        language = column[6].text.strip()

        length = None
        length_text = column[7].text.strip()
        if len(length_text) != 0:
            length = length_text.split()[0]

        element = SubmitRecord(judge_id=column[0].text,
                               mem=column[4].contents[0],
                               time=column[5].contents[0],
                               code_len=length)

        if table.get(language) is None:
            table[language] = element
        else:
            table[language] = min(table[language], element)

    problem_name = rows[0].find_all('td')[2].a['title']

    screenLock.acquire()
    print("{:5s} {}".format(problem_num, problem_name))
    for l, e in table.items():
        print("\t{:10s} {}".format(l, e))
    screenLock.release()

    return table
Example #3
0
    elif language in ['bc']:
        return 'bc'
    elif language in ['Nemerle']:
        return 'n'
    elif language in ['Cobra']:
        return 'cobra'
    elif language in ['Nimrod']:
        return 'nim'
    elif language in ['Io']:
        return 'io'
    elif language in ['아희']:
        return 'aheui'


if __name__ == '__main__':
    user_id = input('enter nickname : ')
    user_pw = getpass('enter password : '******'https://acmicpc.net/user/' + user_id)

    working_dir = os.path.join(os.getcwd(), user_id)

    if not os.path.exists(working_dir):
        os.makedirs(working_dir)

    problem_set = get_solved_problems(soup)

    get_submitted_files(problem_set)
Example #4
0
    elif language in ['bc']:
        return 'bc'
    elif language in ['Nemerle']:
        return 'n'
    elif language in ['Cobra']:
        return 'cobra'
    elif language in ['Nimrod']:
        return 'nim'
    elif language in ['Io']:
        return 'io'
    elif language in ['아희']:
        return 'aheui'


if __name__ == '__main__':
    user_id = input('enter nickname : ')
    user_pw = getpass('enter password : '******'https://acmicpc.net/user/' + user_id)

    working_dir = os.path.join(os.getcwd(), user_id)

    if not os.path.exists(working_dir):
        os.makedirs(working_dir)

    problem_set = get_solved_problems(soup)

    get_submitted_files(problem_set)