| Bytes | Lang | Time | Link |
|---|---|---|---|
| 027 | Charcoal | 250502T003326Z | Neil |
| 126 | Python | 250502T203232Z | Albert.L |
| 231 | Google Sheets | 250502T073211Z | doubleun |
| 162 | Python3 | 250501T182553Z | Ajax1234 |
| 030 | 05AB1E | 250501T132404Z | Kevin Cr |
| 028 | Jelly | 250501T003303Z | Jonathan |
Charcoal, 45 32 27 bytes
⬤θ⊙θ¬ΣE²§ΦEθ§θ⁺κ×ρ⊖⊗ν⁼↔π↔λ⁰
Try it online! Link is to verbose version of code. Outputs a Charcoal boolean, i.e. - if the cycle is covered, nothing if not. Explanation:
⬤θ
All members of the input must be in a block, computed as...
⊙θ
... some value exists...
E²§ΦEθ§θ⁺κ×ρ⊖⊗ν⁼↔π↔λ⁰
... whose first occurrences in the cyclic and reverse cyclic permutations of the input starting at that member...
¬Σ
... differ only in sign. (So the member itself doesn't qualify, because its first occurrences don't differ as they are both itself.)
θ Input array
⬤ All elements satisfy
θ Input array
⊙ Any element satisfies
² Literal integer `2`
E Map over implicit range
θ Input array
E Map over elements
θ Input array
§ Indexed by
κ Outermost index
⁺ Plus
ρ Innermost index
× Times
ν Inner value
⊗ Doubled
⊖ Decremented
Φ Filtered where
π Innermost value
↔ Absolute value
⁼ Equals
λ Outer value
↔ Absolute value
§ Indexed by
⁰ Literal integer `0`
Σ Take the sum
¬ Is zero
Implicitly print
Python, 126 bytes
def f(L,i=0,j=0):n=len(L);a,*S,b=(3*L)[i+n-1-j%n:i+n+2+j//n];c=({a,b}&{*S}or a+b)and-1;return i==n or j<n*n and f(L,c-~i,c*~j)
Returns True if input is block covered, otherwise False. Input cannot be empty.
Google Sheets, 231 bytes
=let(e,tocol({A:A;A:A},1),s,sequence(rows(e)),count(unique(e))=count(unique(reduce(tocol(,1),s,lambda(a,i,let(c,index(e,i),j,+filter(s,s>i,-e=c),v,filter(e,i<s,s<j),if(isna(j)+ifna(sort(match(abs(c),abs(v),0))),a,vstack(a,v))))))))

Ungolfed:
=let(
elements, tocol(vstack(A1:A, A1:A), 1),
indices, sequence(rows(elements)),
withinCycles, reduce(tocol(, 1), indices, lambda(acc, i, let(
curr, index(elements, i),
j, single(filter(indices, indices > i, -elements = curr)),
within, filter(elements, i < indices, indices < j),
if(isna(j) + ifna(sort(match(abs(curr), abs(within), 0))),
acc,
ifna(vstack(acc, within))
)
))),
count(unique(withinCycles)) = count(unique(elements))
)
Python3, 162 bytes
def f(s):
k=[]
for i,a in enumerate(s):
I,t=i,[]
while(I:=(I+1)%len(s))!=i and s[I]!=a:
t+=[I]
if -1*s[I]==a:k+=t[:-1];break
return len({*k})==len(s)
05AB1E, 31 30 bytes
.āD«ŒʒøнDÁ2£DO_Š¢P*}妨€θ}˜Ù∍Q
Try it online or verify all test cases.
Explanation:
.ā # Enumerate the (implicit) input-list,
# pairing each value with its index
D # Duplicate this list
« # Merge the two together
Œ # Get all sublists of this 2x-cycled list
ʒ # Filter this list of sublists by:
ø # Zip/transpose; swapping rows/columns
н # Leave just the first list of values,
# since we don't need to indices yet
D # Duplicate this list
Á2£ # Pop and leave a pair of the first and last values
# (or just one if it's a singleton-list)
Á # Rotate the copy once clockwise
2£ # Pop and leave the first two items
D # Duplicate that pair
O_ # Check that it's an [n,-n]-pair
O # Sum the pair together
_ # Check whether that sum equals 0
Š # Triple-swap so the duplicated list and pair are at the top
¢ # Count how many times the values in the pair occur in the list
P # Product these counts
# (we're expecting counts [1,1], for the first/last items themselves)
* # Multiply the two checks together
# (only 1 is truthy in 05AB1E)
}ε # After the filter: map over all remaining sublists:
¦¨ # Remove the first and last items
€ # Map over each remaining pair
θ # Leave just the last item with indices
}˜ # After the nested maps: flatten the list of indices
Ù # Uniquify this list of indices
∍Q # Check that its length equals the length of the input-list:
∍ # Pop and extend/shorten the (implicit) input-list to a size equal to
# this list
Q # Check if that extended/shortened list equals the (implicit) input,
# aka it hasn't been extended nor shortened
# (after which the result is output implicitly)
Jelly, 28 bytes
Ė;`ẆZṪṪ;ḢSȯfɗƲƊÐḟṖ€Ḋ€ẎZḢḟ@JẸ
A monadic Link that accepts a list of non-zero integers and yields 0 if the set of its blocks covers its elements, or 1 if not.
Try it online! Or see the test-suite.
How?
Ė;`ẆZṪṪ;ḢSȯfɗƲƊÐḟṖ€Ḋ€ẎZḢḟ@JẸ - Link: list of integers, C
Ė - enumerate {C} -> [[1, c1], [2, c2], ... [|C|, c|C|]]
;` - concatenate that with itself
Ẇ - all non-empty sublists of that
ƊÐḟ - discard those for which:
Z - transpose
Ṫ - tail -> S = the raw sublist of C
S = [ca, cb, ... cy, cz]
Ʋ - last four links as a monad - f(S):
Ṫ - tail of {S} (alters S -> [ca, cb, ... cy])
Ḣ - head of {S} (alters S -> [cb, ... cy])
; - concatenate these -> [cz, ca]
ɗ - last three links as a dyad - f([cz, ca], [cb, ... cy]):
S - sum {[cz, ca]} -> 0 if cz == -1 × ca
f - {[cz, ca]} filter keep {[cb, ... cy]}
ȯ - logical OR of these
Ṗ€Ḋ€ - pop each and dequeue each
ZḢ - traspose and head -> indices covered
ḟ@J - indices of {C} filter keep {indices covered}
Ẹ - any?