- Repository Purpose: This repository contains solutions to competitive programming problems, primarily from Kattis.
- Language Used: C++ and Python (could add this to CI/CD later)
- Auto-updated Statistics:
Language | Files Solved |
---|---|
C++ | 13 |
Python | 1 |
Total | 12 |
.github/workflows/
: Contains automation scripts for CI/CD.README.md
: Contains project description and auto-generated stats.
To automate Kattis submissions and organize accepted files:
-
Install Prerequisites:
- Python: Download Python
- Kattis CLI: Kattis CLI
- Python Packages:
pip install requests beautifulsoup4
- Ensure you have a valid
.kattisrc
file in your home directory with your credentials. You can get it from here.
-
Add
submit_and_move.py
:- The script is in
scripts/submit_and_move.py
.
- The script is in
-
Configure VSCode Task: Add this to
.vscode/tasks.json
:{ "version": "2.0.0", "tasks": [ { "label": "Submit to Kattis", "type": "shell", "command": "python", "args": ["${workspaceFolder}/scripts/submit_and_move.py", "${file}"], "presentation": { "echo": true, "reveal": "always", "focus": true, "panel": "shared", "showReuseMessage": false, "clear": false, "close": true }, "problemMatcher": [] } ] }
-
Setup Keybinding: Add to
keybindings.json
:[ { "key": "f12", "command": "workbench.action.tasks.runTask", "args": "Submit to Kattis", "when": "editorTextFocus" } ]
-
Create
solutions
Folder: Manually create the folder or the script will create it automatically. -
Submit Solution:
- Keep unfinished solutions in the root directory. Open the solution file (e.g.,
kattisexercise.cpp
), pressF7
, and it will automatically upload the solution to Kattis. If accepted, the script moves the file to thesolutions
folder.
- Keep unfinished solutions in the root directory. Open the solution file (e.g.,
- Kattis CLI Documentation: Kattis CLI GitHub
Automate the creation of problem sets with specified language templates:
-
Add
create_problem_set.py
:- Ensure your script is in the
scripts
folder and can handle language options.
- Ensure your script is in the
Remember to change the VSCODE_PATH
variable in the script to your own path:
VSCODE_PATH = r"C:\Users\simon\AppData\Local\Programs\Microsoft VS Code\Code.exe" #Remember to change this to your own path
-
Configure VSCode Tasks: Add the following to your
.vscode/tasks.json
:{ "version": "2.0.0", "tasks": [ { "label": "Create New Problem Set (py)", "type": "shell", "command": "python", "presentation": { "echo": true, "reveal": "always", "focus": true, "panel": "shared", "showReuseMessage": false, "clear": false, "close": true }, "args": [ "${workspaceFolder}/scripts/create_problem_set.py", "-l", "py" ] }, { "label": "Create New Problem Set (cpp)", "type": "shell", "command": "python", "presentation": { "echo": true, "reveal": "always", "focus": true, "panel": "shared", "showReuseMessage": false, "clear": false, "close": true }, "args": [ "${workspaceFolder}/scripts/create_problem_set.py", "-l", "cpp" ] } ] }
-
Setup Keybindings: Add to keybindings.json:
[
{
"key": "f9", // For C++
"command": "workbench.action.tasks.runTask",
"args": "Create New Problem Set (cpp)",
"when": "true"
},
{
"key": "f10", // For Python
"command": "workbench.action.tasks.runTask",
"args": "Create New Problem Set (py)",
"when": "true"
}
]
- Use the Tasks:
- Press
F9
to create a new Python problem set. - Press
F10
to create a new C++ problem set.
Ensure you have template.py and template.cpp in your root directory to serve as templates for new problem sets.