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/010_math_permsign/00_solved.in | 8 -------- test/010_math_permsign/00_solved.out | 1 - test/010_math_permsign/01_3cycle.in | 6 ------ test/010_math_permsign/01_3cycle.out | 1 - test/010_math_permsign/02_22swap.in | 13 ------------- test/010_math_permsign/02_22swap.out | 1 - test/010_math_permsign/03_singleswap.in | 7 ------- test/010_math_permsign/03_singleswap.out | 1 - test/010_math_permsign/04_5ycle.in | 11 ----------- test/010_math_permsign/04_5ycle.out | 1 - test/010_math_permsign/05_6ycle.in | 9 --------- test/010_math_permsign/05_6ycle.out | 1 - test/010_math_permsign/permsgn_tests.c | 20 -------------------- test/010_math_permtoindex/00_noperm.in | 4 ++++ test/010_math_permtoindex/00_noperm.out | 1 + test/010_math_permtoindex/01_toobig.in | 16 ++++++++++++++++ test/010_math_permtoindex/01_toobig.out | 1 + test/010_math_permtoindex/02_offrange.in | 4 ++++ test/010_math_permtoindex/02_offrange.out | 1 + test/010_math_permtoindex/03_2_solved.in | 3 +++ test/010_math_permtoindex/03_2_solved.out | 1 + test/010_math_permtoindex/04_2_swapped.in | 3 +++ test/010_math_permtoindex/04_2_swapped.out | 1 + test/010_math_permtoindex/05_7_solved.in | 8 ++++++++ test/010_math_permtoindex/05_7_solved.out | 1 + test/010_math_permtoindex/06_7_reversed.in | 8 ++++++++ test/010_math_permtoindex/06_7_reversed.out | 1 + test/010_math_permtoindex/07_4_random.in | 5 +++++ test/010_math_permtoindex/07_4_random.out | 1 + test/010_math_permtoindex/permtoindex_tests.c | 19 +++++++++++++++++++ test/011_math_indextoperm/00_noperm.in | 2 ++ test/011_math_indextoperm/00_noperm.out | 3 +++ test/011_math_indextoperm/01_toobig.in | 2 ++ test/011_math_indextoperm/01_toobig.out | 15 +++++++++++++++ test/011_math_indextoperm/02_offrange.in | 2 ++ test/011_math_indextoperm/02_offrange.out | 3 +++ test/011_math_indextoperm/03_2_solved.in | 2 ++ test/011_math_indextoperm/03_2_solved.out | 2 ++ test/011_math_indextoperm/04_2_swapped.in | 2 ++ test/011_math_indextoperm/04_2_swapped.out | 2 ++ test/011_math_indextoperm/05_7_solved.in | 2 ++ test/011_math_indextoperm/05_7_solved.out | 7 +++++++ test/011_math_indextoperm/06_7_reversed.in | 2 ++ test/011_math_indextoperm/06_7_reversed.out | 7 +++++++ test/011_math_indextoperm/07_4_random.in | 2 ++ test/011_math_indextoperm/07_4_random.out | 4 ++++ test/011_math_indextoperm/indextoperm_tests.c | 19 +++++++++++++++++++ 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 +++++++++++++++++++++ 60 files changed, 237 insertions(+), 80 deletions(-) delete mode 100644 test/010_math_permsign/00_solved.in delete mode 100644 test/010_math_permsign/00_solved.out delete mode 100644 test/010_math_permsign/01_3cycle.in delete mode 100644 test/010_math_permsign/01_3cycle.out delete mode 100644 test/010_math_permsign/02_22swap.in delete mode 100644 test/010_math_permsign/02_22swap.out delete mode 100644 test/010_math_permsign/03_singleswap.in delete mode 100644 test/010_math_permsign/03_singleswap.out delete mode 100644 test/010_math_permsign/04_5ycle.in delete mode 100644 test/010_math_permsign/04_5ycle.out delete mode 100644 test/010_math_permsign/05_6ycle.in delete mode 100644 test/010_math_permsign/05_6ycle.out delete mode 100644 test/010_math_permsign/permsgn_tests.c create mode 100644 test/010_math_permtoindex/00_noperm.in create mode 100644 test/010_math_permtoindex/00_noperm.out create mode 100644 test/010_math_permtoindex/01_toobig.in create mode 100644 test/010_math_permtoindex/01_toobig.out create mode 100644 test/010_math_permtoindex/02_offrange.in create mode 100644 test/010_math_permtoindex/02_offrange.out create mode 100644 test/010_math_permtoindex/03_2_solved.in create mode 100644 test/010_math_permtoindex/03_2_solved.out create mode 100644 test/010_math_permtoindex/04_2_swapped.in create mode 100644 test/010_math_permtoindex/04_2_swapped.out create mode 100644 test/010_math_permtoindex/05_7_solved.in create mode 100644 test/010_math_permtoindex/05_7_solved.out create mode 100644 test/010_math_permtoindex/06_7_reversed.in create mode 100644 test/010_math_permtoindex/06_7_reversed.out create mode 100644 test/010_math_permtoindex/07_4_random.in create mode 100644 test/010_math_permtoindex/07_4_random.out create mode 100644 test/010_math_permtoindex/permtoindex_tests.c create mode 100644 test/011_math_indextoperm/00_noperm.in create mode 100644 test/011_math_indextoperm/00_noperm.out create mode 100644 test/011_math_indextoperm/01_toobig.in create mode 100644 test/011_math_indextoperm/01_toobig.out create mode 100644 test/011_math_indextoperm/02_offrange.in create mode 100644 test/011_math_indextoperm/02_offrange.out create mode 100644 test/011_math_indextoperm/03_2_solved.in create mode 100644 test/011_math_indextoperm/03_2_solved.out create mode 100644 test/011_math_indextoperm/04_2_swapped.in create mode 100644 test/011_math_indextoperm/04_2_swapped.out create mode 100644 test/011_math_indextoperm/05_7_solved.in create mode 100644 test/011_math_indextoperm/05_7_solved.out create mode 100644 test/011_math_indextoperm/06_7_reversed.in create mode 100644 test/011_math_indextoperm/06_7_reversed.out create mode 100644 test/011_math_indextoperm/07_4_random.in create mode 100644 test/011_math_indextoperm/07_4_random.out create mode 100644 test/011_math_indextoperm/indextoperm_tests.c 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') diff --git a/test/010_math_permsign/00_solved.in b/test/010_math_permsign/00_solved.in deleted file mode 100644 index 54b5db0..0000000 --- a/test/010_math_permsign/00_solved.in +++ /dev/null @@ -1,8 +0,0 @@ -7 -0 -1 -2 -3 -4 -5 -6 diff --git a/test/010_math_permsign/00_solved.out b/test/010_math_permsign/00_solved.out deleted file mode 100644 index 573541a..0000000 --- a/test/010_math_permsign/00_solved.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/010_math_permsign/01_3cycle.in b/test/010_math_permsign/01_3cycle.in deleted file mode 100644 index bfabfd6..0000000 --- a/test/010_math_permsign/01_3cycle.in +++ /dev/null @@ -1,6 +0,0 @@ -5 -0 -4 -1 -3 -2 diff --git a/test/010_math_permsign/01_3cycle.out b/test/010_math_permsign/01_3cycle.out deleted file mode 100644 index 573541a..0000000 --- a/test/010_math_permsign/01_3cycle.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/010_math_permsign/02_22swap.in b/test/010_math_permsign/02_22swap.in deleted file mode 100644 index d0b0921..0000000 --- a/test/010_math_permsign/02_22swap.in +++ /dev/null @@ -1,13 +0,0 @@ -12 -0 -1 -8 -3 -5 -4 -6 -7 -2 -9 -10 -11 diff --git a/test/010_math_permsign/02_22swap.out b/test/010_math_permsign/02_22swap.out deleted file mode 100644 index 573541a..0000000 --- a/test/010_math_permsign/02_22swap.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/010_math_permsign/03_singleswap.in b/test/010_math_permsign/03_singleswap.in deleted file mode 100644 index 42a584b..0000000 --- a/test/010_math_permsign/03_singleswap.in +++ /dev/null @@ -1,7 +0,0 @@ -6 -4 -1 -2 -3 -0 -5 diff --git a/test/010_math_permsign/03_singleswap.out b/test/010_math_permsign/03_singleswap.out deleted file mode 100644 index d00491f..0000000 --- a/test/010_math_permsign/03_singleswap.out +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/010_math_permsign/04_5ycle.in b/test/010_math_permsign/04_5ycle.in deleted file mode 100644 index 630f6fa..0000000 --- a/test/010_math_permsign/04_5ycle.in +++ /dev/null @@ -1,11 +0,0 @@ -10 -0 -1 -6 -2 -3 -4 -5 -7 -8 -9 diff --git a/test/010_math_permsign/04_5ycle.out b/test/010_math_permsign/04_5ycle.out deleted file mode 100644 index 573541a..0000000 --- a/test/010_math_permsign/04_5ycle.out +++ /dev/null @@ -1 +0,0 @@ -0 diff --git a/test/010_math_permsign/05_6ycle.in b/test/010_math_permsign/05_6ycle.in deleted file mode 100644 index a226bae..0000000 --- a/test/010_math_permsign/05_6ycle.in +++ /dev/null @@ -1,9 +0,0 @@ -8 -6 -0 -1 -3 -2 -4 -5 -7 diff --git a/test/010_math_permsign/05_6ycle.out b/test/010_math_permsign/05_6ycle.out deleted file mode 100644 index d00491f..0000000 --- a/test/010_math_permsign/05_6ycle.out +++ /dev/null @@ -1 +0,0 @@ -1 diff --git a/test/010_math_permsign/permsgn_tests.c b/test/010_math_permsign/permsgn_tests.c deleted file mode 100644 index 04975db..0000000 --- a/test/010_math_permsign/permsgn_tests.c +++ /dev/null @@ -1,20 +0,0 @@ -#include "../test.h" - -int permsign(uint8_t *, int); - -void run(void) { - char str[STRLENMAX]; - uint8_t a[100]; - int n, i, p; - - fgets(str, STRLENMAX, stdin); - n = atoi(str); - - for (i = 0; i < n; i++) { - fgets(str, STRLENMAX, stdin); - a[i] = atoi(str); - } - - p = permsign(a, n); - printf("%d\n", p); -} diff --git a/test/010_math_permtoindex/00_noperm.in b/test/010_math_permtoindex/00_noperm.in new file mode 100644 index 0000000..f838f21 --- /dev/null +++ b/test/010_math_permtoindex/00_noperm.in @@ -0,0 +1,4 @@ +3 +0 +1 +1 diff --git a/test/010_math_permtoindex/00_noperm.out b/test/010_math_permtoindex/00_noperm.out new file mode 100644 index 0000000..3a2e3f4 --- /dev/null +++ b/test/010_math_permtoindex/00_noperm.out @@ -0,0 +1 @@ +-1 diff --git a/test/010_math_permtoindex/01_toobig.in b/test/010_math_permtoindex/01_toobig.in new file mode 100644 index 0000000..a0fb28c --- /dev/null +++ b/test/010_math_permtoindex/01_toobig.in @@ -0,0 +1,16 @@ +15 +0 +1 +2 +3 +4 +5 +6 +7 +8 +9 +10 +11 +12 +13 +14 diff --git a/test/010_math_permtoindex/01_toobig.out b/test/010_math_permtoindex/01_toobig.out new file mode 100644 index 0000000..3a2e3f4 --- /dev/null +++ b/test/010_math_permtoindex/01_toobig.out @@ -0,0 +1 @@ +-1 diff --git a/test/010_math_permtoindex/02_offrange.in b/test/010_math_permtoindex/02_offrange.in new file mode 100644 index 0000000..66ec716 --- /dev/null +++ b/test/010_math_permtoindex/02_offrange.in @@ -0,0 +1,4 @@ +3 +0 +4 +1 diff --git a/test/010_math_permtoindex/02_offrange.out b/test/010_math_permtoindex/02_offrange.out new file mode 100644 index 0000000..3a2e3f4 --- /dev/null +++ b/test/010_math_permtoindex/02_offrange.out @@ -0,0 +1 @@ +-1 diff --git a/test/010_math_permtoindex/03_2_solved.in b/test/010_math_permtoindex/03_2_solved.in new file mode 100644 index 0000000..4c5d59c --- /dev/null +++ b/test/010_math_permtoindex/03_2_solved.in @@ -0,0 +1,3 @@ +2 +0 +1 diff --git a/test/010_math_permtoindex/03_2_solved.out b/test/010_math_permtoindex/03_2_solved.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/010_math_permtoindex/03_2_solved.out @@ -0,0 +1 @@ +0 diff --git a/test/010_math_permtoindex/04_2_swapped.in b/test/010_math_permtoindex/04_2_swapped.in new file mode 100644 index 0000000..ae13693 --- /dev/null +++ b/test/010_math_permtoindex/04_2_swapped.in @@ -0,0 +1,3 @@ +2 +1 +0 diff --git a/test/010_math_permtoindex/04_2_swapped.out b/test/010_math_permtoindex/04_2_swapped.out new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/test/010_math_permtoindex/04_2_swapped.out @@ -0,0 +1 @@ +1 diff --git a/test/010_math_permtoindex/05_7_solved.in b/test/010_math_permtoindex/05_7_solved.in new file mode 100644 index 0000000..54b5db0 --- /dev/null +++ b/test/010_math_permtoindex/05_7_solved.in @@ -0,0 +1,8 @@ +7 +0 +1 +2 +3 +4 +5 +6 diff --git a/test/010_math_permtoindex/05_7_solved.out b/test/010_math_permtoindex/05_7_solved.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/test/010_math_permtoindex/05_7_solved.out @@ -0,0 +1 @@ +0 diff --git a/test/010_math_permtoindex/06_7_reversed.in b/test/010_math_permtoindex/06_7_reversed.in new file mode 100644 index 0000000..ed11605 --- /dev/null +++ b/test/010_math_permtoindex/06_7_reversed.in @@ -0,0 +1,8 @@ +7 +6 +5 +4 +3 +2 +1 +0 diff --git a/test/010_math_permtoindex/06_7_reversed.out b/test/010_math_permtoindex/06_7_reversed.out new file mode 100644 index 0000000..ad2ea70 --- /dev/null +++ b/test/010_math_permtoindex/06_7_reversed.out @@ -0,0 +1 @@ +5039 diff --git a/test/010_math_permtoindex/07_4_random.in b/test/010_math_permtoindex/07_4_random.in new file mode 100644 index 0000000..614bc61 --- /dev/null +++ b/test/010_math_permtoindex/07_4_random.in @@ -0,0 +1,5 @@ +4 +0 +2 +3 +1 diff --git a/test/010_math_permtoindex/07_4_random.out b/test/010_math_permtoindex/07_4_random.out new file mode 100644 index 0000000..00750ed --- /dev/null +++ b/test/010_math_permtoindex/07_4_random.out @@ -0,0 +1 @@ +3 diff --git a/test/010_math_permtoindex/permtoindex_tests.c b/test/010_math_permtoindex/permtoindex_tests.c new file mode 100644 index 0000000..98c8207 --- /dev/null +++ b/test/010_math_permtoindex/permtoindex_tests.c @@ -0,0 +1,19 @@ +#include "../test.h" + +int64_t permtoindex(uint8_t *, int64_t); + +void run(void) { + char str[STRLENMAX]; + uint8_t a[100]; + int64_t n, i, p; + + fgets(str, STRLENMAX, stdin); + n = atoll(str); + for (i = 0; i < n; i++) { + fgets(str, STRLENMAX, stdin); + a[i] = atoi(str); + } + + p = permtoindex(a, n); + printf("%" PRId64 "\n", p); +} diff --git a/test/011_math_indextoperm/00_noperm.in b/test/011_math_indextoperm/00_noperm.in new file mode 100644 index 0000000..81d7aba --- /dev/null +++ b/test/011_math_indextoperm/00_noperm.in @@ -0,0 +1,2 @@ +3 +-1 diff --git a/test/011_math_indextoperm/00_noperm.out b/test/011_math_indextoperm/00_noperm.out new file mode 100644 index 0000000..c656952 --- /dev/null +++ b/test/011_math_indextoperm/00_noperm.out @@ -0,0 +1,3 @@ +255 +255 +255 diff --git a/test/011_math_indextoperm/01_toobig.in b/test/011_math_indextoperm/01_toobig.in new file mode 100644 index 0000000..227eae2 --- /dev/null +++ b/test/011_math_indextoperm/01_toobig.in @@ -0,0 +1,2 @@ +15 +0 diff --git a/test/011_math_indextoperm/01_toobig.out b/test/011_math_indextoperm/01_toobig.out new file mode 100644 index 0000000..a4cc325 --- /dev/null +++ b/test/011_math_indextoperm/01_toobig.out @@ -0,0 +1,15 @@ +255 +255 +255 +255 +255 +255 +255 +255 +255 +255 +255 +255 +255 +255 +255 diff --git a/test/011_math_indextoperm/02_offrange.in b/test/011_math_indextoperm/02_offrange.in new file mode 100644 index 0000000..47b5fdd --- /dev/null +++ b/test/011_math_indextoperm/02_offrange.in @@ -0,0 +1,2 @@ +3 +10 diff --git a/test/011_math_indextoperm/02_offrange.out b/test/011_math_indextoperm/02_offrange.out new file mode 100644 index 0000000..c656952 --- /dev/null +++ b/test/011_math_indextoperm/02_offrange.out @@ -0,0 +1,3 @@ +255 +255 +255 diff --git a/test/011_math_indextoperm/03_2_solved.in b/test/011_math_indextoperm/03_2_solved.in new file mode 100644 index 0000000..389e262 --- /dev/null +++ b/test/011_math_indextoperm/03_2_solved.in @@ -0,0 +1,2 @@ +2 +0 diff --git a/test/011_math_indextoperm/03_2_solved.out b/test/011_math_indextoperm/03_2_solved.out new file mode 100644 index 0000000..0d66ea1 --- /dev/null +++ b/test/011_math_indextoperm/03_2_solved.out @@ -0,0 +1,2 @@ +0 +1 diff --git a/test/011_math_indextoperm/04_2_swapped.in b/test/011_math_indextoperm/04_2_swapped.in new file mode 100644 index 0000000..5f1d0ec --- /dev/null +++ b/test/011_math_indextoperm/04_2_swapped.in @@ -0,0 +1,2 @@ +2 +1 diff --git a/test/011_math_indextoperm/04_2_swapped.out b/test/011_math_indextoperm/04_2_swapped.out new file mode 100644 index 0000000..b261da1 --- /dev/null +++ b/test/011_math_indextoperm/04_2_swapped.out @@ -0,0 +1,2 @@ +1 +0 diff --git a/test/011_math_indextoperm/05_7_solved.in b/test/011_math_indextoperm/05_7_solved.in new file mode 100644 index 0000000..a8148db --- /dev/null +++ b/test/011_math_indextoperm/05_7_solved.in @@ -0,0 +1,2 @@ +7 +0 diff --git a/test/011_math_indextoperm/05_7_solved.out b/test/011_math_indextoperm/05_7_solved.out new file mode 100644 index 0000000..09c277a --- /dev/null +++ b/test/011_math_indextoperm/05_7_solved.out @@ -0,0 +1,7 @@ +0 +1 +2 +3 +4 +5 +6 diff --git a/test/011_math_indextoperm/06_7_reversed.in b/test/011_math_indextoperm/06_7_reversed.in new file mode 100644 index 0000000..a09bc61 --- /dev/null +++ b/test/011_math_indextoperm/06_7_reversed.in @@ -0,0 +1,2 @@ +7 +5039 diff --git a/test/011_math_indextoperm/06_7_reversed.out b/test/011_math_indextoperm/06_7_reversed.out new file mode 100644 index 0000000..61d1e47 --- /dev/null +++ b/test/011_math_indextoperm/06_7_reversed.out @@ -0,0 +1,7 @@ +6 +5 +4 +3 +2 +1 +0 diff --git a/test/011_math_indextoperm/07_4_random.in b/test/011_math_indextoperm/07_4_random.in new file mode 100644 index 0000000..81450f3 --- /dev/null +++ b/test/011_math_indextoperm/07_4_random.in @@ -0,0 +1,2 @@ +4 +3 diff --git a/test/011_math_indextoperm/07_4_random.out b/test/011_math_indextoperm/07_4_random.out new file mode 100644 index 0000000..2696809 --- /dev/null +++ b/test/011_math_indextoperm/07_4_random.out @@ -0,0 +1,4 @@ +0 +2 +3 +1 diff --git a/test/011_math_indextoperm/indextoperm_tests.c b/test/011_math_indextoperm/indextoperm_tests.c new file mode 100644 index 0000000..cb1306d --- /dev/null +++ b/test/011_math_indextoperm/indextoperm_tests.c @@ -0,0 +1,19 @@ +#include "../test.h" + +void indextoperm(int64_t, int64_t, uint8_t *); + +void run(void) { + char str[STRLENMAX]; + uint8_t a[100]; + int64_t n, p, i; + + fgets(str, STRLENMAX, stdin); + n = atoll(str); + fgets(str, STRLENMAX, stdin); + p = atoll(str); + + indextoperm(p, n, a); + + for (i = 0; i < n; i++) + printf("%" PRIu8 "\n", a[i]); +} 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