Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Algorithms and Data Structures problems and solutions from my personal study.

NotificationsYou must be signed in to change notification settings

fgmacedo/problems_ads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Algorithms and Data Structures problems and solutions from my personal study.

Setup

pip install poetrypoetry install

Running problems

pytest

Adding problems and test scenarios

Adding a new problem is as simple as adding a new folder inside theproblems folder with at least a python script for the solution, and a test scenario in the pattern<scenario_name>.in for input and<scenario_name>.out to the expected output.

As in this example:

problems├── codeforces_101879_tea│   ├── case_2_to_6.in│   ├── case_2_to_6.out│   ├── case_impossible.in│   ├── case_impossible.out│   ├── case_small1.in│   ├── case_small1.out│   ├── codeforces_101879_tea.py│   └── problem.md└── uri_2448_postman    ├── case_large1.in    ├── case_large1.out    ├── case_large2.in    ├── case_large2.out    ├── case_small.in    ├── case_small.out    ├── case_small2.in    ├── case_small2.out    └── uri_2448_postman.py

Note: As I'm running the solution program using subprocess, It may support implementing solutions using other languages with changes in the collection method atconftest.py. Contributions are welcome.

All problems and test scenarios will be collected automatically when you run pytest using file pattern matching:

❯ pytest -v======== test session starts ========linux -- Python 3.8.1, pytest-6.2.2, py-1.10.0, pluggy-0.13.1 --...collected 7 itemstest_contests.py::test_contests[problems/codeforces_101879_tea/codeforces_101879_tea.py-case_2_to_6] PASSEDtests.py::test_contests[problems/codeforces_101879_tea/codeforces_101879_tea.py-case_impossible] PASSEDtest_contests.py::test_contests[problems/codeforces_101879_tea/codeforces_101879_tea.py-case_2_to_6] PASSEDtests.py::test_contests[problems/codeforces_101879_tea/codeforces_101879_tea.py-case_impossible] PASSEDtests.py::test_contests[problems/codeforces_101879_tea/codeforces_101879_tea.py-case_small1] PASSEDtests.py::test_contests[problems/uri_2448_postman/uri_2448_postman.py-case_large1] PASSEDtests.py::test_contests[problems/uri_2448_postman/uri_2448_postman.py-case_large2] PASSEDtests.py::test_contests[problems/uri_2448_postman/uri_2448_postman.py-case_small] PASSEDtests.py::test_contests[problems/uri_2448_postman/uri_2448_postman.py-case_small2] PASSED

You can also run benchmarks when running with:

 pytest --benchmark-enable

Testing code manually

Inspect profiling:

cat problems/kattis_ferryloading4/sample.in | python -m cProfile -s cumtime ./problems/kattis_ferryloading4/kattis_ferryloading4.py --debug

Find unused code usingvulture:

cat problems/url_1030_flavius_josephhus/sample.in | python -m vulture ./problems/url_1030_flavius_josephhus/url_1030_flavius_josephhus.py

About

Algorithms and Data Structures problems and solutions from my personal study.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp