From 53a178571c59c6eb8ca86d67ef59940858ea2305 Mon Sep 17 00:00:00 2001 From: Mateusz Masiarz Date: Mon, 25 Sep 2023 11:43:35 +0200 Subject: [PATCH] Add package with long names of solutions --- tests/packages/long_solution_names/config.yml | 45 +++++++++++++++++++ .../packages/long_solution_names/in/.gitkeep | 0 .../packages/long_solution_names/out/.gitkeep | 0 .../packages/long_solution_names/prog/lsn.cpp | 9 ++++ .../prog/lsn1sol_long_name.cpp | 12 +++++ .../prog/lsnb10sol_long_name.cpp | 34 ++++++++++++++ .../long_solution_names/prog/lsningen.cpp | 18 ++++++++ .../prog/lsns1sol_long_name.cpp | 20 +++++++++ .../prog/lsnsol_long_name.cpp | 17 +++++++ tests/util.py | 7 +++ 10 files changed, 162 insertions(+) create mode 100644 tests/packages/long_solution_names/config.yml create mode 100644 tests/packages/long_solution_names/in/.gitkeep create mode 100644 tests/packages/long_solution_names/out/.gitkeep create mode 100644 tests/packages/long_solution_names/prog/lsn.cpp create mode 100644 tests/packages/long_solution_names/prog/lsn1sol_long_name.cpp create mode 100644 tests/packages/long_solution_names/prog/lsnb10sol_long_name.cpp create mode 100644 tests/packages/long_solution_names/prog/lsningen.cpp create mode 100644 tests/packages/long_solution_names/prog/lsns1sol_long_name.cpp create mode 100644 tests/packages/long_solution_names/prog/lsnsol_long_name.cpp diff --git a/tests/packages/long_solution_names/config.yml b/tests/packages/long_solution_names/config.yml new file mode 100644 index 00000000..80ad7057 --- /dev/null +++ b/tests/packages/long_solution_names/config.yml @@ -0,0 +1,45 @@ +title: Package with long solution names +sinol_task_id: lsn +memory_limit: 16000 +time_limit: 1000 +scores: + 1: 25 + 2: 25 + 3: 25 + 4: 25 +sinol_expected_scores: + lsn.cpp: + expected: + 1: {points: 25, status: OK} + 2: {points: 25, status: OK} + 3: {points: 25, status: OK} + 4: {points: 25, status: OK} + points: 100 + lsn1sol_long_name.cpp: + expected: + 1: {points: 25, status: OK} + 2: {points: 25, status: OK} + 3: {points: 25, status: OK} + 4: {points: 0, status: WA} + points: 75 + lsnb10sol_long_name.cpp: + expected: + 1: {points: 25, status: OK} + 2: {points: 0, status: WA} + 3: {points: 0, status: WA} + 4: {points: 0, status: ML} + points: 25 + lsns1sol_long_name.cpp: + expected: + 1: {points: 25, status: OK} + 2: {points: 0, status: WA} + 3: {points: 0, status: WA} + 4: {points: 0, status: TL} + points: 25 + lsnsol_long_name.cpp: + expected: + 1: {points: 25, status: OK} + 2: {points: 25, status: OK} + 3: {points: 0, status: WA} + 4: {points: 0, status: RE} + points: 50 diff --git a/tests/packages/long_solution_names/in/.gitkeep b/tests/packages/long_solution_names/in/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/tests/packages/long_solution_names/out/.gitkeep b/tests/packages/long_solution_names/out/.gitkeep new file mode 100644 index 00000000..e69de29b diff --git a/tests/packages/long_solution_names/prog/lsn.cpp b/tests/packages/long_solution_names/prog/lsn.cpp new file mode 100644 index 00000000..9d30bab0 --- /dev/null +++ b/tests/packages/long_solution_names/prog/lsn.cpp @@ -0,0 +1,9 @@ +#include + +using namespace std; + +int main() { + int a, b; + cin >> a >> b; + cout << a + b; +} diff --git a/tests/packages/long_solution_names/prog/lsn1sol_long_name.cpp b/tests/packages/long_solution_names/prog/lsn1sol_long_name.cpp new file mode 100644 index 00000000..c1b5782e --- /dev/null +++ b/tests/packages/long_solution_names/prog/lsn1sol_long_name.cpp @@ -0,0 +1,12 @@ +#include + +using namespace std; + +int main() { + int a, b; + cin >> a >> b; + if (a == 4) + cout << a + b + 1; + else + cout << a + b; +} diff --git a/tests/packages/long_solution_names/prog/lsnb10sol_long_name.cpp b/tests/packages/long_solution_names/prog/lsnb10sol_long_name.cpp new file mode 100644 index 00000000..129e4932 --- /dev/null +++ b/tests/packages/long_solution_names/prog/lsnb10sol_long_name.cpp @@ -0,0 +1,34 @@ +#include + +using namespace std; + +int rnd() { + return rand() % 100; +} + +int main() { + int a, b; + cin >> a >> b; + if (a == 1) + cout << a + b; + else if (a == 2 || a == 3) + cout << a + b + 2; + else if (a == 4) { + vector v; + for (int i = 0; i <= 10000; i++) { + int *tmp = new int[1000]; + for (int j = 0; j < 1000; j++) { + tmp[j] = rnd(); + } + v.push_back(tmp); + } + int s = 0; + for (auto i : v) { + for (int j = 0; j < 1000; j++) { + s = (s + i[j]) % 1000000007; + } + delete[] i; + } + cout << a + b; + } +} diff --git a/tests/packages/long_solution_names/prog/lsningen.cpp b/tests/packages/long_solution_names/prog/lsningen.cpp new file mode 100644 index 00000000..1794def2 --- /dev/null +++ b/tests/packages/long_solution_names/prog/lsningen.cpp @@ -0,0 +1,18 @@ +#include + +using namespace std; + +int main() { + ofstream f("lsn1a.in"); + f << "1 3\n"; + f.close(); + f.open("lsn2a.in"); + f << "2 5\n"; + f.close(); + f.open("lsn3a.in"); + f << "3 7\n"; + f.close(); + f.open("lsn4a.in"); + f << "4 9\n"; + f.close(); +} diff --git a/tests/packages/long_solution_names/prog/lsns1sol_long_name.cpp b/tests/packages/long_solution_names/prog/lsns1sol_long_name.cpp new file mode 100644 index 00000000..6979f775 --- /dev/null +++ b/tests/packages/long_solution_names/prog/lsns1sol_long_name.cpp @@ -0,0 +1,20 @@ +#include + +using namespace std; + +int main() { + int a, b; + cin >> a >> b; + if (a == 1) + cout << a + b; + else if (a == 2 || a == 3) + cout << a + b - 1; + else if (a == 4) { + time_t start = time(0); + int i = 0; + while (time(0) - start < 5) { + i++; + } + cout << a + b; + } +} diff --git a/tests/packages/long_solution_names/prog/lsnsol_long_name.cpp b/tests/packages/long_solution_names/prog/lsnsol_long_name.cpp new file mode 100644 index 00000000..f339f90d --- /dev/null +++ b/tests/packages/long_solution_names/prog/lsnsol_long_name.cpp @@ -0,0 +1,17 @@ +#include + +using namespace std; + +int main() { + int a, b; + cin >> a >> b; + if (a == 1 || a == 2) + cout << a + b; + else if (a == 3) + cout << a + b + 2; + else if (a == 4) { + int c = 0; + cout << a + b / c; + return 1; + } +} diff --git a/tests/util.py b/tests/util.py index 3034c9dd..36472175 100644 --- a/tests/util.py +++ b/tests/util.py @@ -122,6 +122,13 @@ def get_icpc_package_path(): return os.path.join(os.path.dirname(__file__), "packages", "icpc") +def get_long_solution_names_package(): + """ + Get path to package with long solution names (/tests/packages/long_solution_names) + """ + return os.path.join(os.path.dirname(__file__), "packages", "long_solution_names") + + def create_ins(package_path, task_id): """ Create .in files for package.