lol
This commit is contained in:
parent
542b276f06
commit
6d10ae8c7e
10
.gitignore
vendored
10
.gitignore
vendored
@ -1,3 +1,6 @@
|
|||||||
|
# Trying to not leak credentials
|
||||||
|
kattis.py
|
||||||
|
|
||||||
# ---> Python
|
# ---> Python
|
||||||
# Byte-compiled / optimized / DLL files
|
# Byte-compiled / optimized / DLL files
|
||||||
__pycache__/
|
__pycache__/
|
||||||
@ -83,6 +86,13 @@ target/
|
|||||||
profile_default/
|
profile_default/
|
||||||
ipython_config.py
|
ipython_config.py
|
||||||
|
|
||||||
|
|
||||||
|
# VSCode
|
||||||
|
.vscode/
|
||||||
|
|
||||||
|
# Env
|
||||||
|
.env/
|
||||||
|
|
||||||
# pyenv
|
# pyenv
|
||||||
# For a library or package, you might want to ignore these files since the code is
|
# For a library or package, you might want to ignore these files since the code is
|
||||||
# intended to run in multiple environments; otherwise, check them in:
|
# intended to run in multiple environments; otherwise, check them in:
|
||||||
|
5
kattis/.vscode/settings.json
vendored
5
kattis/.vscode/settings.json
vendored
@ -1,5 +0,0 @@
|
|||||||
{
|
|
||||||
"files.associations": {
|
|
||||||
"stdlib.h": "c"
|
|
||||||
}
|
|
||||||
}
|
|
28
kattis/.vscode/tasks.json
vendored
28
kattis/.vscode/tasks.json
vendored
@ -1,28 +0,0 @@
|
|||||||
{
|
|
||||||
"tasks": [
|
|
||||||
{
|
|
||||||
"type": "cppbuild",
|
|
||||||
"label": "C/C++: gcc build active file",
|
|
||||||
"command": "/sbin/gcc",
|
|
||||||
"args": [
|
|
||||||
"-fdiagnostics-color=always",
|
|
||||||
"-g",
|
|
||||||
"${file}",
|
|
||||||
"-o",
|
|
||||||
"${fileDirname}/${fileBasenameNoExtension}"
|
|
||||||
],
|
|
||||||
"options": {
|
|
||||||
"cwd": "${fileDirname}"
|
|
||||||
},
|
|
||||||
"problemMatcher": [
|
|
||||||
"$gcc"
|
|
||||||
],
|
|
||||||
"group": {
|
|
||||||
"kind": "build",
|
|
||||||
"isDefault": true
|
|
||||||
},
|
|
||||||
"detail": "Task generated by Debugger."
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"version": "2.0.0"
|
|
||||||
}
|
|
@ -1,76 +0,0 @@
|
|||||||
from autokattis import Kattis
|
|
||||||
import argparse
|
|
||||||
from os import system
|
|
||||||
from requests import get
|
|
||||||
from bs4 import BeautifulSoup
|
|
||||||
from datetime import datetime
|
|
||||||
|
|
||||||
def prepare_problem(problem):
|
|
||||||
system('firefox ' + problem['link'])
|
|
||||||
name = " "
|
|
||||||
try:
|
|
||||||
name = problem['pid']
|
|
||||||
except:
|
|
||||||
name = problem['name']
|
|
||||||
|
|
||||||
# system('mkdir problems/' + datetime.now.strftime("%d_%m_%y") + "/" name)
|
|
||||||
|
|
||||||
# TODO: Add inputs
|
|
||||||
r = get(problem['link'])
|
|
||||||
# tables = soup.find_all('table')
|
|
||||||
# soup = BeautifulSoup(r.text, 'html.parser')
|
|
||||||
# for table in tables:
|
|
||||||
# with open("problems/" + problem['pid'] + "/"+ str(count) + ".in", "w") as f:
|
|
||||||
# f.write(table[0].text)
|
|
||||||
# print(table.text)
|
|
||||||
|
|
||||||
def find_user(ranklist:dict) -> int:
|
|
||||||
for i in ranklist:
|
|
||||||
if i['username'] == 'confestim':
|
|
||||||
return i['rank']
|
|
||||||
return -1
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(description='Kattis submission tool')
|
|
||||||
parser.add_argument('-p', metavar='problem', type=str, help='problem name')
|
|
||||||
parser.add_argument('-pl', action='store_true', default=False, help='plot problem')
|
|
||||||
parser.add_argument('-s', action='store_true', default=False, help='suggest problem')
|
|
||||||
parser.add_argument('-r', action='store_true', default=False, help='Show ranklist')
|
|
||||||
parser.add_argument('-u', action="store_true", default=False, help="ShowStarted, but Unsolved")
|
|
||||||
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
kt = Kattis('confestim', 'changed the password i leaked im sorry', )
|
|
||||||
problem = args.p
|
|
||||||
plot = args.pl
|
|
||||||
suggest = args.s
|
|
||||||
unsolved = args.u
|
|
||||||
|
|
||||||
if args.r:
|
|
||||||
uni = find_user(kt.ranklist(university='University of Groningen'))
|
|
||||||
country = find_user(kt.ranklist(country='Bulgaria'))
|
|
||||||
print("🎓:" + str(uni) + ", 🤻 :" + str(country))
|
|
||||||
if plot:
|
|
||||||
print(kt.plot_problems(show_partial=False))
|
|
||||||
|
|
||||||
if suggest:
|
|
||||||
for i in kt.suggest():
|
|
||||||
prepare_problem(i)
|
|
||||||
|
|
||||||
def stars(problem):
|
|
||||||
return problem["difficulty"]
|
|
||||||
|
|
||||||
if unsolved:
|
|
||||||
problems = kt.problems(show_solved=False, show_tried=True)
|
|
||||||
problems.sort(key=stars)
|
|
||||||
print(str(len(problems)) + " problems unsolved.")
|
|
||||||
for problem in problems:
|
|
||||||
print(f"✱ {problem['name']} {problem['difficulty']}✪")
|
|
||||||
yn = input("Do you want to open them in browser?(Y/n)")
|
|
||||||
if (yn == 'n' or yn == 'N'):
|
|
||||||
pass
|
|
||||||
else:
|
|
||||||
for problem in problems:
|
|
||||||
prepare_problem(problem)
|
|
||||||
|
|
||||||
elif problem:
|
|
||||||
print(kt.problem(problem))
|
|
Loading…
x
Reference in New Issue
Block a user