From 518d98ad5f9eec0cf4124375bdbb84d1296b3f3f Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Thu, 4 Jul 2024 17:09:55 +0200 Subject: (almost) added getcube --- test/012_math_permsign/00_solved.in | 8 ++++++++ test/012_math_permsign/00_solved.out | 1 + test/012_math_permsign/01_3cycle.in | 6 ++++++ test/012_math_permsign/01_3cycle.out | 1 + test/012_math_permsign/02_22swap.in | 13 +++++++++++++ test/012_math_permsign/02_22swap.out | 1 + test/012_math_permsign/03_singleswap.in | 7 +++++++ test/012_math_permsign/03_singleswap.out | 1 + test/012_math_permsign/04_5ycle.in | 11 +++++++++++ test/012_math_permsign/04_5ycle.out | 1 + test/012_math_permsign/05_6ycle.in | 9 +++++++++ test/012_math_permsign/05_6ycle.out | 1 + test/012_math_permsign/permsign_tests.c | 21 +++++++++++++++++++++ 13 files changed, 81 insertions(+) create mode 100644 test/012_math_permsign/00_solved.in create mode 100644 test/012_math_permsign/00_solved.out create mode 100644 test/012_math_permsign/01_3cycle.in create mode 100644 test/012_math_permsign/01_3cycle.out create mode 100644 test/012_math_permsign/02_22swap.in create mode 100644 test/012_math_permsign/02_22swap.out create mode 100644 test/012_math_permsign/03_singleswap.in create mode 100644 test/012_math_permsign/03_singleswap.out create mode 100644 test/012_math_permsign/04_5ycle.in create mode 100644 test/012_math_permsign/04_5ycle.out create mode 100644 test/012_math_permsign/05_6ycle.in create mode 100644 test/012_math_permsign/05_6ycle.out create mode 100644 test/012_math_permsign/permsign_tests.c (limited to 'test/012_math_permsign') diff --git a/test/012_math_permsign/00_solved.in b/test/012_math_permsign/00_solved.in new file mode 100644 index 0000000..54b5db0 --- /dev/null +++ b/test/012_math_permsign/00_solved.in @@ -0,0 +1,8 @@ +7 +0 +1 +2 +3 +4 +5 +6 diff --git a/test/012_math_permsign/00_solved.out b/test/012_math_permsign/00_solved.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/012_math_permsign/00_solved.out @@ -0,0 +1 @@ +0 diff --git a/test/012_math_permsign/01_3cycle.in b/test/012_math_permsign/01_3cycle.in new file mode 100644 index 0000000..bfabfd6 --- /dev/null +++ b/test/012_math_permsign/01_3cycle.in @@ -0,0 +1,6 @@ +5 +0 +4 +1 +3 +2 diff --git a/test/012_math_permsign/01_3cycle.out b/test/012_math_permsign/01_3cycle.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/012_math_permsign/01_3cycle.out @@ -0,0 +1 @@ +0 diff --git a/test/012_math_permsign/02_22swap.in b/test/012_math_permsign/02_22swap.in new file mode 100644 index 0000000..d0b0921 --- /dev/null +++ b/test/012_math_permsign/02_22swap.in @@ -0,0 +1,13 @@ +12 +0 +1 +8 +3 +5 +4 +6 +7 +2 +9 +10 +11 diff --git a/test/012_math_permsign/02_22swap.out b/test/012_math_permsign/02_22swap.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/012_math_permsign/02_22swap.out @@ -0,0 +1 @@ +0 diff --git a/test/012_math_permsign/03_singleswap.in b/test/012_math_permsign/03_singleswap.in new file mode 100644 index 0000000..42a584b --- /dev/null +++ b/test/012_math_permsign/03_singleswap.in @@ -0,0 +1,7 @@ +6 +4 +1 +2 +3 +0 +5 diff --git a/test/012_math_permsign/03_singleswap.out b/test/012_math_permsign/03_singleswap.out new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/test/012_math_permsign/03_singleswap.out @@ -0,0 +1 @@ +1 diff --git a/test/012_math_permsign/04_5ycle.in b/test/012_math_permsign/04_5ycle.in new file mode 100644 index 0000000..630f6fa --- /dev/null +++ b/test/012_math_permsign/04_5ycle.in @@ -0,0 +1,11 @@ +10 +0 +1 +6 +2 +3 +4 +5 +7 +8 +9 diff --git a/test/012_math_permsign/04_5ycle.out b/test/012_math_permsign/04_5ycle.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/012_math_permsign/04_5ycle.out @@ -0,0 +1 @@ +0 diff --git a/test/012_math_permsign/05_6ycle.in b/test/012_math_permsign/05_6ycle.in new file mode 100644 index 0000000..a226bae --- /dev/null +++ b/test/012_math_permsign/05_6ycle.in @@ -0,0 +1,9 @@ +8 +6 +0 +1 +3 +2 +4 +5 +7 diff --git a/test/012_math_permsign/05_6ycle.out b/test/012_math_permsign/05_6ycle.out new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/test/012_math_permsign/05_6ycle.out @@ -0,0 +1 @@ +1 diff --git a/test/012_math_permsign/permsign_tests.c b/test/012_math_permsign/permsign_tests.c new file mode 100644 index 0000000..fa8ce9b --- /dev/null +++ b/test/012_math_permsign/permsign_tests.c @@ -0,0 +1,21 @@ +#include "../test.h" + +int permsign(uint8_t *, int64_t); + +void run(void) { + char str[STRLENMAX]; + uint8_t a[100]; + int p; + int64_t n, i; + + fgets(str, STRLENMAX, stdin); + n = atoll(str); + + for (i = 0; i < n; i++) { + fgets(str, STRLENMAX, stdin); + a[i] = atoi(str); + } + + p = permsign(a, n); + printf("%d\n", p); +} -- cgit v1.3