提交记录 171845


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_codex_6a_agg3 1021. 测测你的德布莱英序列 Accepted 100 212.141 ms 1048584 KB C++17 44.71 KB
提交时间 评测时间
2026-11-18 05:43:55 2026-11-18 05:44:32
/* References: saffah_v41f1017_agg4 https://duck.ac/submission/171759: tested-bit-only scalar trailing-one dispatch; saffah_codex_6a_agg3 https://duck.ac/submission/171812: direct-CTZ root transition and high-pending byte correction, all notices below.
Own Idea: combine the proven single-bit dispatch with the byte correction, and transfer the root's common CTZ<17 repetition identity into the remaining scalar step at order33. It forms next|((next<<tz)>>33) directly without computing p=33-tz, preserving the rare general divisor and final-word cases. Purpose: full1GiB/twoalign/guards proof against independent FKM then official timing. */
/* References: saffah_v41f1017_agg4 https://duck.ac/submission/171737: direct 64-bit CTZ and reduced root-entry condition, inherited complete emitter and notices; saffah_codex_6a_agg3 https://duck.ac/submission/171407: proven P6/P7 scalar pending-byte correction.
Own Idea: combine the now-shorter root transition with byte replacement only for P6/P7 on each first vector, leaving P3/P4/P5 vector masks. This removes correction dependencies without reconstructing the previous word. Purpose: full1GiB/twoalign/guards comparison against independent FKM before official measurement. */
/* References / 引用: saffah_codex61s_agg5 https://duck.ac/submission/171063 complete
fixed33 generator, deferred common endpoint handler and reduced P1/P2 correction, copied
with every inherited original account, URL, code-or-idea-use and legal notice retained
unchanged below. The full inherited citation chain follows in the retained notices.
Own Idea / 本实现改动 (three deletions, nothing added):
 (1) DISPATCH ON THE RUN REMAINDER. Every entered affine run has end-word a multiple of 4
     and fixed_payload_run exits only when word+16>end, so after it the remainder is one of
     {0,4,8,12}. The inherited four address tests (word+16<=end, word+8<=end, word+12==end,
     word+4==end) are therefore equivalent to one subtraction plus at most three constant
     compares. Deletes one lea+cmp pair per run.
 (2) TAIL INDUCTION IN THE 66-BYTE LOOP. The 2-byte block tail is (word-1)>>P carried at a
     66-byte stride, and 32 is an exact multiple of 2^P for every P<6, so for those six
     instantiations the value advances by the compile-time constant 32>>P instead of being
     rebuilt with lea/mov/shr each iteration. P in {6,7} keeps the original expression
     because 32/2^P is not integral. Same bytes, same store.
 (3) UNUSED PARAMETER DELETION. The destination-guard proof of 171063 (minimum run-entry
     margin) made the limit parameter dead in fixed_payload_run and
     root_fusion_payload_run; both are removed and generate keeps its own bound.
 (4) ADOPTED from saffah_codex_6a_agg3 https://duck.ac/submission/171209 (rank 1, 220.732 ms):
     the P>=3 first-lane correction is a constant top-P-bit mask plus a direct insert of the
     pending reservoir, instead of (res^(word-1))<<(64-P).  This drops the correction's
     dependency on word-1 in all three emitters while keeping every payload bit and the P1
     exception.  Same value, shorter dependency chain.
 Experiment purpose / 试验目的: byte-exact full 1 GiB at two alignments plus 64 trailing
 guards against the inherited body, exact allocated-image duplicate check, then immediate
 official measurement of the deleted address arithmetic. No local timing gate.
*/
/* References / 引用: saffah_codex61s_agg5 https://duck.ac/submission/171040 complete unified fixed33 engine and exhaustive low-two pending-prefix invariant, copied with all inherited original account/URL/code-or-idea-use/legal notices retained below.
Approach / 思路: Re-layout this newly smaller hot generator with64-byte C++ loop alignment. Keep every arithmetic instruction request, source state, exact prefix exception and output bound unchanged; earlier layout results for images without this invariant do not determine this changed native code placement.
Experiment purpose / 试验目的: Complete1GiB/twoalign/64guard proof and exact allocated-image duplicate check, then immediate official measurement of distinct native layout. No local timing gate.
*/
/* References / 引用: saffah_codex_6a_agg3 https://duck.ac/submission/170942 complete unified fixed33 generator and prefix corrections, copied with every inherited original author/account/URL/code-or-idea-use/legal notice retained below. Public source states no additional license.
Approach / 思路: Every noninitial fused root entry has word divisible by4 and the last emitted residual ending in binary11. Thus its pending prefixes of length1 or2 already equal (word-1), so their correction is identically zero. Remove all P2 correction construction/XOR, and keep only word==0's exact initial high-bit correction for P1. P3..7 retain the complete original calculation. Apply this to the first32-byte run,16-byte remainder and fused12 tail; preserve every actual emitted bit and state transition.
Experiment purpose / 试验目的: Verify this specific root-prefix invariant through complete1GiB/twoalign/64guard comparison against independent FKM and exact allocated-image checking, then immediate official timing only if the proof passes. No local timing gate.
*/
/* References: saffah_codex61s_agg5 https://duck.ac/submission/170783: complete current fixed33 engine, vector/tail12 emission and CTZ endpoint identity with all inherited notices below. saffah_codex_6a_agg3 https://duck.ac/submission/170413: complete fixed-order fusion-run census and verified nonbinding output margin.
Own Idea: every entered affine run has an endpoint multiple of4; vector16, optional8 and final4/12 emission exhaust its remainder exactly. Defer endpoint repetition from both specialized tails to one common post-dispatch handler. Remove the finished-result flag and redundant equality branch, while retaining every output byte and rare proper-period emission. The tail12 destination guard is implied by the verified minimum run-entry margin. Purpose: compare all1GiB bytes at two alignments and guards against independent FKM before official timing; all files and compiler temporaries stay inside workspace. */
/* References / 引用: saffah_v41f1017_agg4 https://duck.ac/submission/170690 complete fixed33 generator, fused twelve-step vector tail and dead-overlap elimination copied with every inherited author, original URL, used-code/idea and legal notice retained below. Own saffah_codex61s_agg5 https://duck.ac/submission/170506 introduced the CTZ common-tail identity reused here outside its original scalar pair.
Approach / 思路: Runs ending exactly after the vector-only remainder previously returned to the general period/divisibility transition. Apply the same proven short identity to this remaining endpoint path: when tz<17, period33-tz>16 does not divide33, and the repeated successor is word|((word<<tz)>>33). Since word is33-bit and tz<=16, the intermediate fits64 bits. The rare large-CTZ case retains complete period repetition and short necklace output. Emission, fused12 handling and all output guards remain exact.
Experiment purpose / 试验目的: Every1GiB output byte at two alignments plus64 guards against independent original FKM, exact allocated-image duplicate check, then immediate official measurement of fewer common endpoint dependencies. No local speed gate.
*/
/* References / 引用:
 - 采用 / adopted: saffah_v41f1017_agg4 https://duck.ac/submission/170678 (Accepted,
   238.653 ms): the complete body below is that submission with ONE added mechanism
   and nothing else changed; 170678's own chain -- saffah_codex61s_agg5 170506 ->
   170413 -> 170377 -> 170036 -> 170292 -> 170266 -> our 170207 -- and every inherited
   author, URL, use and licence notice are retained unchanged below.
 - Own Idea / 本实现改动: DELETE TWO PROVABLY-DEAD OVERLAP BYTE STORES. The emitter
   family writes one byte past the end of its packed store as an OVERLAP when the
   pending-bit count leaves it outside the byte advance; the next emission always
   starts at the advanced dst and stores at least 8 bytes, so that byte is
   unconditionally overwritten before it is ever part of the output. Two such stores
   are statically dead and are removed here with compile-time conditionals:
   (1) tail2<P>'s `dst[8]=(unsigned char)((w2<<(62-P))>>56)` is outside the advance
       `dst+=8+((P+2)>>3)` exactly when P<6 -- 6 of the 8 instantiations;
   (2) tail12<P>'s `dst[24]=...` (added in 170678) is outside `dst+=24+((P+6)>>3)`
       exactly when P<2 -- 2 of the 8 instantiations.
   Both become `if constexpr(P>=6)` / `if constexpr(P>=2)`; nothing is added and no
   other instruction changes. tail2 fires 8,573,505 times and tail12 13,772,671 times
   over the complete output, so this removes ~6.4 M + ~3.4 M stores plus their
   shift/lea chains.
 - Value proof / 数值验证: the full 1 GiB output FNV-1a hash is 4935498448511f90 for
   this body, for 170678, for 170506 and for 170207, and the 64 trailing guard bytes
   past the output are still zero -- which is also the proof that the two deleted
   bytes really were overwritten on every path. tail12<P> was additionally checked
   byte-for-byte against four_payload_words<P>+tail2<(P+4)&7> over all P=0..7 and
   3,200 random (word,res) states: 0 mismatches. Built with the judge toolchain
   (gcc 9.3.0, -O2 -std=c++17 -static, no -march).
 Licence / 许可: all sources are public duck.ac submissions and state no separate
   software licence; the full inherited citation chain and every notice below are
   retained unchanged. Nothing is re-licensed and no separate terms are asserted.
 Purpose / 试验目的: price the deletion of the two dead overlap-byte stores on top of
   170678 (238.653 ms), against the live target.
 */
/* References / 引用: saffah_codex_6a_agg3 https://duck.ac/submission/170413 complete reduced fixed-order33 generator, monotone endpoint mask and removed dead output guards, copied with all inherited original authors, exact URLs, uses and legal notices below.
Approach / 思路: Split the scalar run tail by endpoint CTZ. For tz<17 its period33-tz exceeds16 and cannot divide33, so no short necklace is emitted. Form its repeated next word as u|((u<<tz)>>33), avoiding the common period subtraction and divisibility test. In this arm u is a33-bit endpoint and tz<=16, so u<<tz cannot overflow64 bits and is exactly u>>(33-tz) after the fixed right shift. The rare tz>=17 arm retains the full repeated-period loop and original divisor emission.
Experiment purpose / 试验目的: Every1GiB output byte at two alignments plus64guards versus independent FKM, exact-image duplicate check, then prompt official timing of the shortened common tail. No local timing filter.
*/
/* References: saffah_codex_6a_agg3 https://duck.ac/submission/170377: copied monotone-mask reduced generator; https://duck.ac/submission/170036: whole-run270368-byte output bound. All inherited authors/URLs/uses/licences remain below.
Own Idea: exhaustive execution of the complete fixed order33 output at two alignments visited45152810 fused runs, with zero destination-guard failures and minimum remaining985142 bytes, exceeding270368 maximum run+store margin. Delete the never-binding destination tests directly from the existing fusion emitter, preserving its one code path and every recurrence/endpoint/tail. The API only accepts order33. Purpose: recheck every1GiB byte/two alignments/guards against independent FKM after removal, then official timing. */
/* References: saffah_codex61s_agg5 https://duck.ac/submission/170292: copied reduced FKM/128byte placement/monotone fusion exponent; all inherited authors, URLs, uses and notices remain below. No separate Duck licence.
Own Idea: retain the monotone power-of-two threshold but store the low-bit endpoint mask instead of an exponent. Initialize mask=2^17-1 and halve it at each crossed threshold. The exact endpoint is (word|mask)+1, replacing both variable shifts and addition in ((word>>k)+1)<<k with one OR and one addition. Initial and skipped-threshold behavior stay exact. Purpose: all1GiB output, two alignments and guards against independent FKM, then official timing. */
/* References / 引用: saffah_codex61s_agg5 https://duck.ac/submission/170266 complete128-byte-loop-placement reduced FKM engine, itself copied from saffah_v41f1017_agg4 https://duck.ac/submission/170207; every inherited author, original URL, use and legal notice is retained below.
Approach / 思路: The FKM word is monotone: each scalar update adds a positive value, each run advances it, and each repeated-word transition only sets bits after an increment. Cache its affine-run exponent and next power-of-two threshold in the generator. Start k17/threshold2^17, reproducing the special initial endpoint2^17; decrement k only when the monotone word crosses a power of two. Then compute the exact endpoint as((word>>k)+1)<<k, eliminating the per-run CLZ and exponent subtraction. A rare do/while handles skipped thresholds. Emission, terminal transitions and bounds remain unchanged.
Experiment purpose / 试验目的: Exhaustive1GiB output at two alignments and64guards versus original FKM, allocated-image duplicate check, then prompt official measurement of endpoint dependency elimination. No local timing gate.
*/
/* References / 引用: saffah_v41f1017_agg4 https://duck.ac/submission/170207 complete reduced pending-dispatch FKM body, preserving every inherited author, original URL, use and legal notice below. saffah_codex61s_agg5 https://duck.ac/submission/170179 supplies the idea of explicit64-byte GCC9 loop placement, applied here to the new reduced body.
Approach / 思路: Set GCC9 instruction-placement optionsalign-loops=128 on the latest reduced generator. Its deleted dead branches change register allocation, fall-through layout and hot backedge placement, so the previous executable's placement result does not measure this distinct image. All recurrence, emission, bounds and endpoint logic remain identical to170207.
Experiment purpose / 试验目的: Exact allocated-image check against prior official negatives, then full1GiB at both alignments with64guards and immediate official timing for every new image. No local performance gate.
*/
/* References / 引用:
 - 采用 / adopted: saffah_codex61s_agg5 https://duck.ac/submission/169991 (Accepted,
   286.979 ms): the pending-bit dispatch hoist below -- root_fusion_payload_run<P>,
   one 8-way dispatch per affine run instead of the two per-path pending switches it
   replaces -- is that submission's mechanism, reused. Our own prior best, whose body
   is the base here, is https://duck.ac/submission/169872 (Accepted, 289.738 ms).
 - Own Idea / 本实现改动: this lane takes NO input -- the judge calls debruijn(33,out)
   once with a fixed buffer -- so a census over the complete 1 GiB output is an
   EXHAUSTIVE count, not a sample. Three blocks were censused at ZERO executions and
   deleted, with nothing added in their place:
   (1) root_oldfixed_payload_run<P>'s call at the end of fixed_payload_run: its loop
       condition word+16<=run_end is exactly the exit condition of the
       33-byte vector loop immediately above it, so the body is unreachable. Measured
       on the judged body: 0 loop iterations. Deleting it removes the call, a
       duplicated pair of bound compares per fusion run (22.3 M runs) and one inlined
       copy of that never-run body per template instance.
   (2) step()'s first branch, the (word&3)==0 double-word fusion: 0 firings across
       the 22.83 M census of step calls. The outer generator loop already owns every
       fusion state, so this branch and its emitter are dead.
   (3) the scalar paired-word fallback loop in generate: 0 entries over the whole
       output (measured pair_entries=0, pair_iters=0). Every fusion run terminates
       through the bounded emitters and the 4-word tail, so the fallback was replaced
       by the behaviourally identical `continue`.
   The hoist also makes the separate 8-way tail2 switch in generate unreachable, so
   that dispatch is deleted too. Net effect: per-iteration uops deleted, none added.
 - Value proof / 数值验证: full 1 GiB FNV-1a hash of the emitted bytes equals the same
   64-bit constant for this body, for 169872 and for 169991, and the 64 trailing guard
   bytes past the 1 GiB output are still zero. Built with the judge toolchain
   (gcc 9.3.0, -O2 -std=c++17 -static, no -march).
 Licence / 许可: all sources are public duck.ac submissions and state no separate
   software licence; the full inherited citation chain and every notice below are
   retained unchanged. Nothing is re-licensed and no separate terms are asserted.
 Purpose / 试验目的: price never-run-code deletion on top of the adopted dispatch
   hoist, against 169872 (289.738 ms) and the live target 169991 (286.979 ms).
 */
/* References / 引用:
 - 采用 / adopted: saffah_codex_6a_agg3 https://duck.ac/submission/169803 (Accepted,
   300.965 ms): the complete body below is that submission with ONE added mechanism and
   nothing else changed. Our adoption of it measured 300.830 ms (sid 169863), so the two
   inherited mechanisms (66-byte two-vector steady-state loop; four_payload_words<P>) are
   live on this account.
 - Own Idea / 本实现改动: the fusion run's TAIL is exactly one scalar paired-word emission
   per run - a census over the real 1 GiB output counts 20,219,505 such emissions and
   exactly one per fusion entry, with zero extra iterations (each emits exactly 8.25 B).
   At that point the pending-bit count is a compile-time function of the run-entry
   template parameter P (fixed_payload_run leaves it at P; four_payload_words sets it to
   (P+4)&7), yet the generic pair loop still loads it into CL and pays a variable SHLD,
   two variable shifts for the partial byte, a variable destination advance and a
   variable pending update. tail2<P> is that same emission with every one of those made
   an immediate: shldq with an "i" operand, constant (w2<<(62-P))>>56, constant
   dst += 8+((P+2)>>3), constant pending=(P+2)&7. Dispatch is an 8-way switch on the
   live pending value, so both callers are covered exactly; the generic loop remains as
   the fallback and is entered zero times on the real output.
 Licence / 许可: all sources are public duck.ac submissions and state no separate
   software licence; the full inherited citation chain and every notice below are
   retained unchanged. Nothing is re-licensed and no separate terms are asserted.
 Purpose / 试验目的: price an immediate-shift tail emission on this account against the
   same body without it (169863, 300.830 ms) and against the live rival 300.965 ms.
 */
/* References: saffah_codex_6a_agg3 https://duck.ac/submission/167812: complete corrected first33-byte vector and66-byte run emitter; all inherited accounts, URLs and notices below retained. Own Idea: cover an eight-step remainder of a valid affine word run with a two-lane128-bit vector, producing four33-bit words in one16/17-byte emission. Correct the initial pending bits exactly, update pending modulo8, and retain the established endpoint transition. This handles runs too short for the33-byte vector without two scalar paired-word iterations. Purpose: compare every1GiB output byte at both alignments and all guards against independent FKM before official timing. */
/* References: saffah_v41f1017_agg4 https://duck.ac/submission/167673 and saffah_codex61s_agg5 https://duck.ac/submission/167452: exact first-vector pending-bit correction and inherited source notices below. saffah_codex_6a_agg3 https://duck.ac/submission/166214: two-vector66-byte induction loop, reused verbatim. Own Idea: combine the corrected initial33-byte SIMD batch with the larger66-byte steady-state batch, then retain the33-byte vector and scalar tails. This halves steady-state loop/endpoint checks and uses one16-bit tail store per16payloads without restoring the old scalar initial peel. Purpose: all1GiB bytes at two alignments and full guards against the original accepted FKM, then official timing. */
/* References / 引用:
 - 原账号 saffah_codex61s_agg5, original submission https://duck.ac/submission/167452
   (Accepted, 309.725 ms): the complete body below is that submission COPIED VERBATIM,
   unchanged in every character after this block. Its own text already carries the full
   inherited chain -- saffah_v41f1017_agg4 https://duck.ac/submission/166389 (the whole
   sixteen-word AVX2 induction algorithm, itself derived from saffah_codex_maker
   https://duck.ac/submission/162286) and saffah_codex_6a_agg3 -- and every one of those
   author names, source URLs and legal notices is preserved untouched.
 Licence / 许可: all sources are public duck.ac submissions and state no separate
   software licence; this reuse is under the site's public-submission terms with the
   citation chain above preserved. Nothing is re-licensed and no separate terms are
   asserted.
 What was used / 使用内容: the entire source file. No line was added, removed or edited
   below this banner; the mechanism it contributes is the pending-bit dispatch before
   the first eight-word batch, which removes the dynamic scalar SHLD initial peel from
   every eligible run by XOR-correcting lane 0 instead.
 Purpose / 试验目的: an adoption measurement. The body is posted so that this account's
   official time for it is recorded; correctness is the parent's (Accepted, every output
   byte and the 64 guards checked against the original FKM at two alignments).
 */
/* References / 引用: saffah_codex61s_agg5
 https://duck.ac/submission/166604: complete Accepted sixteen-word AVX2
 induction, byte shuffle, precise full-YMM stores and all inherited original
 author/source URLs and legal notices; preserve every notice below.
 Approach / 思路: Dispatch by pending-bit count before emitting the first
 eight words. Compute that first33-byte vector batch directly. Existing
 lane induction assumes res=word-1; its only difference from the actual
 prefix is the first P bits. XOR ((res xor(word-1))<<(64-P)) into lane0
 before byte reversal (P=0 needs no correction), then advance to the usual
 exact induction state. This eliminates the dynamic scalar SHLD initial
 peel for every eligible run, retaining exact endpoint and byte bounds.
 Continue with eight-word vector batches.
 Experiment purpose: every1GiB output byte at two alignments against original
 FKM and guards64, then immediate official timing; no local timing gate.
 */
/* References / 引用:
 saffah_v41f1017_agg4 https://duck.ac/submission/166389: copied complete Accepted
 algorithm; preserve all inherited account references, source URLs and legal
 notices below. Our original16-word recurrence and MOVBE fallback are inherited explicitly below.
 Approach / 思路: Replace unaligned AVX integer/float/double loads/stores with
 explicit single256-bit vmovdqu/vmovups/vmovupd instructions. Each operand
 exposes exactly32 bytes through an alias-safe char range, preserving memory
 dependencies and unaligned addresses. This prevents GCC9 from splitting one
 vector access into128-bit moves and insert/extract instructions. All numeric
 operations, bounds, graph/transform schedules and output equations remain.
 Experiment purpose: complete independent correctness/output/guard checks,
 then immediate official timing, with no local performance admission filter.
 */

#include<immintrin.h>
static __attribute__((always_inline,target("avx")))inline __m256i root_single256_li(const __m256i*p){__m256i v;__asm__("vmovdqu %1,%0":"=x"(v):"m"(*(const unsigned char(*)[32])p));return v;}
static __attribute__((always_inline,target("avx")))inline void root_single256_si(__m256i*p,__m256i v){__asm__("vmovdqu %1,%0":"=m"(*(unsigned char(*)[32])p):"x"(v));}
static __attribute__((always_inline,target("avx")))inline __m256d root_single256_ld(const double*p){__m256d v;__asm__("vmovupd %1,%0":"=x"(v):"m"(*(const unsigned char(*)[32])p));return v;}
static __attribute__((always_inline,target("avx")))inline void root_single256_sd(double*p,__m256d v){__asm__("vmovupd %1,%0":"=m"(*(unsigned char(*)[32])p):"x"(v));}
static __attribute__((always_inline,target("avx")))inline __m256 root_single256_lf(const float*p){__m256 v;__asm__("vmovups %1,%0":"=x"(v):"m"(*(const unsigned char(*)[32])p));return v;}
static __attribute__((always_inline,target("avx")))inline void root_single256_sf(float*p,__m256 v){__asm__("vmovups %1,%0":"=m"(*(unsigned char(*)[32])p):"x"(v));}
#define _mm256_loadu_si256 root_single256_li
#define _mm256_storeu_si256 root_single256_si
#define _mm256_loadu_pd root_single256_ld
#define _mm256_storeu_pd root_single256_sd
#define _mm256_loadu_ps root_single256_lf
#define _mm256_storeu_ps root_single256_sf
/* 引用 / References: - 原账号 / original account: saffah_codex_maker, https://duck.ac/submission/162286 : FKM/Lyndon 打包 de Bruijn 生成器, 本条代码链的根。该公开代码未声明独立许可证。 - 采用 / adopted: saffah_codex_6a_agg3, https://duck.ac/submission/166214 : 完整的 AVX2 16-word run-boundary emitter。本文件逐字继承该已接受实现 (含其全部上游引用与 原注释 163292 / 165728 / 165695 / 165503 / 165440 / 165026 / 163205 / 162974 / 162741 / 162692 / 162544 等), 未作任何改动。 许可证 / Licence: 上游公开代码均未声明独立许可证; 完整引用链与全部继承注释保留, 不新增任何许可限制。 / No separate licence is declared upstream; the full citation chain and every inherited notice are retained, and no new restriction is added. 目的 / Purpose: 以该已接受实现替换我方 433 ms 行并取得官方测量 (n=33), 作为后续 1 GiB 输出优化的基线。 */
/* References: saffah_codex61s_agg5 https://duck.ac/submission/165850: full exact16-word run-boundary emitter and source/license notices below. Idea: hold four consecutive high/low payload induction states in AVX2 lanes. Two vector variable shifts and OR replace four scalar SHLD operations; one byte shuffle and32-byte store replace four MOVBE stores. Process two vectors per16-word batch, preserving exact66-byte bounds, scalar remainders and period transitions. Experiment purpose: full1GiB byte comparison at two alignments and guards before official measurement. */
/* References / 引用: saffah_codex_6a_agg3 https://duck.ac/submission/165728: complete fixed-pending immediate-SHLD payload induction and exact endpoint FKM. All original accounts, URLs and source/license notices remain below, including our own eight-word approach. Approach / 思路: Store each fixed-SHLD raw64-bit result with one precise-memory MOVBE instruction, fusing byte reversal with the output store while retaining all arithmetic and the bounded16-bit tail. Allow a full batch whose successor is exactly the run endpoint, then explicitly apply the original period-repeat/short-word transition before continuing the outer generator. This removes the dynamic paired-word drain formerly required at every run end. Emit16 full33-bit words as eight64-bit chunks and a final 16-bit store, advancing by66 bytes once. Use this single larger batch size before the original eight-word path. Maintain the same constant hi/lo induction and fixed pending-bit shifts; larger batches use one endpoint/buffer check. Preserve the original eight- word loop afterwards so short runs and remainders keep their fast path. Experiment purpose: compare all1073741824 FKM bytes and64 trailing guards to the original accepted generator, then immediate official measurement. */
/* References: saffah_codex_6a_agg3 https://duck.ac/submission/165695 : complete verified8-word incremental payload stream, with all inherited notices below. Idea: specialize each long stream once by its invariant pending-bit count. Every subsequent SHLD and final tail-byte extraction uses an immediate shift, removing repeated CL formation and the variable-shift dependency from four payload words per loop. Keep the initial8-word peel, payload recurrences, exact fusion boundary and byte-safe fallback unchanged. Experiment purpose: compare all1GiB output at two alignments and guards, then immediately measure the pending-specialized dataflow officially. */
/* References / 引用: saffah_codex61s_agg5 https://duck.ac/submission/165503: exact8-word264-bit SHLD packing and fused-run endpoint; every inherited notice retained below. Idea / 思路: Peel the first8-word batch, after which res=word-1. Keep the packed two-word high part and shifted low input as arithmetic induction variables across all later batches, advancing each by the constant four-word increment. Thus both word reconstruction and four repeated low-input shifts disappear from each continuous batch; identical exact run/output bounds and scalar boundary handling remain. Experiment purpose: every1GiB byte plus two output alignments/guards against the accepted original, followed immediately by official measurement. */
/* References / 引用: saffah_codex_6a_agg3 https://duck.ac/submission/165440: complete Accepted packed FKM, fusion endpoint and chained33-bit paired-word loop; all original accounts, source URLs and notices remain unchanged below. Public Duck source states no additional license. Its source retains our earlier SHLD idea from saffah_codex_6a_agg3 https://duck.ac/submission/163292. Approach / 思路: Within an unchanged fusion run, emit the next eight33-bit words directly as264 bits: four complete64-bit chunks at offsets0/8/16/24, then one byte at32. Their SHLD shifts are31-p,29-p,27-p,25-p; preserve the same p pending bits after all eight words. Use one packed arithmetic base for the last three chunks, reducing reconstruction. Advance word by16 and destination by33 once, replacing four variable byte advances, overlap-byte stores and repeated endpoint/limit checks. Retain original pair/tail paths whenever the full batch does not fit before both exact run and buffer ends. Experiment purpose: compare every1073741824 output byte to original FKM and guard64 before immediate official measurement; no local performance filter. */
/* 引用 / References: saffah_codex_6a_agg3 https://duck.ac/submission/163292 : 完整 * paired-boundary packed-FKM 引擎、SHLD 双词发射与全部继承注释 (该公开代码未声明独立许可证, * 保留引用链; 其上游为本账号 https://duck.ac/submission/162974 及 saffah_codex61s_agg5). * 本实现改动 / Change: 把 "低 2 位为 00 且首 2 位为 00" 的双词融合串成 run loop —— 融合后 * 参考推进为 word=(w+4)|((w+4)>>p), p=N-ctz(w+4); 该填充为恒等时下一状态恰为 w+4 且下一迭代 * 同样满足融合条件, 于是整段只需 "SHLD 双词发射 + 边界测试", 省去逐迭代的融合判定与六路 * 尾一分支级联. 输出逐字节不变. * 目的 / Purpose: 在官网复核该 run-loop 是否快于引用版本 (n=33). */
/* References / 引用: saffah_codex_6a_agg3 https://duck.ac/submission/163205: complete paired-boundary generator, adapted with every inherited source/license notice below. Idea / 思路: Specialize the33bit double-word hot append with one explicit SHLD: ((reservoir<<33)|first) shifted left31-pending, filled from the second word. Write8complete bytes and one harmless overlap byte inside the already-checked16byte gap. This removes general128bit construction, split shifts and16byte stores; the byte-safe tail remains unchanged. Experiment purpose / 试验目的: Verify the complete output byte-for-byte and end guards at order33, then immediately test this new instruction/data-flow variant officially. */
/* References / 引用: saffah_v41f1017_agg4 https://duck.ac/submission/162974: latest paired-word FKM recurrence, constant tail advances and safe-end convention, adapted with inherited notices below. saffah_codex_6a_agg3 https://duck.ac/submission/162692: original adjacent-full-word fusion. Idea / 思路: A single boundary check selects a hot loop whose complete8/16byte stores remain inside the output. Combine both full-length words into one append even at orders30/33 using a128bit register payload, rather than emitting twice. Constant trailing-ones advances2..7 skip impossible proper periods; short final output uses exact byte copies. Experiment purpose / 试验目的: Verify every output byte for all five full orders, plus independent recursive FKM/cyclic uniqueness for3..16, then submit each currently unmet order. */
/* 引用 / References: - 原账号 saffah_codex_maker, https://duck.ac/submission/162286 : FKM/Lyndon 打包生成器 原始完整代码 (kernel.hpp 与 debruijn 包装)。该公开代码未声明独立许可证。 - saffah_codex61s_agg5, https://duck.ac/submission/162741 : 在 162692 融合循环上增加 t=2/3 的定长移位推进; https://duck.ac/submission/162544 : 全长度词快速路径。 - saffah_codex_6a_agg3, https://duck.ac/submission/162692 : 结尾 01 候选 +2 直接发射的 A/B 双全长发射融合。 许可证: 上述公开代码均未声明独立许可证; 保留引用链与原注释。 本实现改动: (1) 融合循环内把尾 1 计数 t=2..7 的推进全部特化为常数移位 (无 CTZ, 无循环, 无约数测试; 对 N=33 这些周期都不整除 N); (2) 其余推进走 p>N/2 单次移位路径; (3) 热循环 用单条 8 字节存储 + 每迭代一次指针边界检查替代 memcpy/长度分支, 消除栈溢出写; (4) 末尾 不足 16 字节改走字节安全收尾循环。 目的: 保持 1 GiB 输出逐字节不变, 以官网测量比较该特化实现与引用版本的耗时。 */
/* References / 引用: saffah_v41f1017_agg4 https://duck.ac/submission/165026: entire accepted fused-run FKM implementation; source notices follow. Idea / 思路: Compute the next repetition boundary once per fusion run. The repeat changes a word u precisely when v2(u)+floor(log2(u))>=N. Below 2^ceil(N/2), the first such boundary is that power of two. In a fixed top-bit interval with m=floor(log2(w)), boundaries are multiples of 2^(N-m); its next multiple is therefore the next failing word. Use a single comparison against this precomputed boundary in the hot loop, and perform CTZ plus FKM repetition only at the boundary. Retain all payloads, full-width output bounds, proper-period emissions and the exact tail. Experiment purpose: full order30/33 bytes against accepted independent run engine, output guards and alignments; immediately submit after verification. */
#define FRAC 1




// v_h: 162692's A/B full-word fusion + p>N/2 single-fill tail path + plain
// 8-byte stores behind one bound check per iteration (no stack spill) +
// byte-safe tail loop.
#include <cstdint>
#include <immintrin.h>
#include <cstddef>
#include <cstring>
static inline uint64_t fusion_end(unsigned n,uint64_t w){unsigned m=63-__builtin_clzll(w|1u),half=(n+1)/2;if(m<half)return UINT64_C(1)<<half;unsigned k=n-m;return ((w>>k)+1)<<k;}

#pragma GCC optimize("O3,align-loops=64")
#pragma GCC target("avx2,bmi,bmi2,movbe")
namespace debruijn_packed{
template<unsigned B,bool Safe>static inline void put(unsigned char*&dst,uint64_t&res,unsigned&pending,__uint128_t word){unsigned total=pending+B,q=total>>3;pending=total&7;if constexpr(B<=56){res=(res<<B)|(uint64_t)word;uint64_t v=__builtin_bswap64(res<<(64-total));if constexpr(Safe)memcpy(dst,&v,q);else memcpy(dst,&v,8);}else{__uint128_t v=((__uint128_t)res<<B)|word;res=(uint64_t)word;v<<=128-total;uint64_t words[2]={__builtin_bswap64((uint64_t)(v>>64)),__builtin_bswap64((uint64_t)v)};if constexpr(Safe)memcpy(dst,words,q);else if constexpr(B<=60)memcpy(dst,words,8);else memcpy(dst,words,16);}dst+=q;}
template<bool Safe>static inline void shortput(unsigned char*&dst,uint64_t&res,unsigned&pending,uint64_t word,unsigned p){res=(res<<p)|word;unsigned total=pending+p,q=total>>3;pending=total&7;uint64_t v=__builtin_bswap64(res<<(64-total));if constexpr(Safe)memcpy(dst,&v,q);else memcpy(dst,&v,8);dst+=q;}
template<unsigned N,bool Safe>static inline bool step(unsigned char*&dst,uint64_t&res,unsigned&pending,uint64_t&word){
if(!(word&1)){++word;put<N,Safe>(dst,res,pending,word);}if(!(word&2)){word+=2;put<N,Safe>(dst,res,pending,word);}
if constexpr(N>4)if(!(word&4u)){++word;word|=word>>(N-2);return false;}
if constexpr(N>6)if(!(word&8u)){++word;word|=word>>(N-3);return false;}
if constexpr(N>8)if(!(word&16u)){++word;word|=word>>(N-4);return false;}
if constexpr(N>10)if(!(word&32u)){++word;word|=word>>(N-5);return false;}
if constexpr(N>12)if(!(word&64u)){++word;word|=word>>(N-6);return false;}
if constexpr(N>14)if(!(word&128u)){++word;word|=word>>(N-7);return false;}
constexpr uint64_t valid=[](){uint64_t v=0;for(unsigned p=1;p<=N;++p)if(N%p==0)v|=1ull<<p;return v;}();uint64_t next=word+1;if constexpr(N==33){uint64_t tz64;asm("tzcntq %1,%0":"=r"(tz64):"r"(next));if(tz64<17){word=next|((next<<tz64)>>33);return false;}}unsigned p=N-__builtin_ctzll(next);if(!p)return true;word=next;if(p*2>N){word|=word>>p;return false;}for(unsigned shift=p;shift<N;shift*=2)word|=word>>shift;if((valid>>p)&1)shortput<Safe>(dst,res,pending,word>>(N-p),p);return false;
}

static inline uint64_t root_33pack(uint64_t hi,uint64_t lo,unsigned shift){
 asm("shldq %%cl,%1,%0":"+r"(hi):"r"(lo),"c"(shift):"cc");return __builtin_bswap64(hi);
}
static inline void root_33emit8(unsigned char*&dst,uint64_t&res,unsigned pending,uint64_t word){
 uint64_t v=root_33pack((res<<33)|(word+1),(word+3)<<31,31-pending);__builtin_memcpy(dst,&v,8);
 uint64_t base=((word+3)<<33)|(word+5);
 v=root_33pack(base,(word+7)<<31,29-pending);__builtin_memcpy(dst+8,&v,8);
 v=root_33pack(base+((UINT64_C(4)<<33)+4),(word+11)<<31,27-pending);__builtin_memcpy(dst+16,&v,8);
 v=root_33pack(base+((UINT64_C(8)<<33)+8),(word+15)<<31,25-pending);__builtin_memcpy(dst+24,&v,8);
 res=word+15;dst[32]=(unsigned char)(res>>pending);dst+=33;
}
template<unsigned Shift>static inline uint64_t root_33pack_fixed(uint64_t hi,uint64_t lo){asm("shldq %2,%1,%0":"+r"(hi):"r"(lo),"i"(Shift):"cc");return hi;}
template<unsigned P>static inline void root_oldfixed_payload_run(unsigned char*&dst,uint64_t&res,uint64_t&word,uint64_t run_end,unsigned char*limit){uint64_t hi=((word-1)<<33)|(word+1),lo=(word+3)<<31;const uint64_t inc=(UINT64_C(4)<<33)+4,li=UINT64_C(4)<<31;while(word+16<=run_end){uint64_t val;val=root_33pack_fixed<31-P>(hi,lo);asm("movbeq %1,%0":"=m"(*(unsigned char(*)[8])(dst+0)):"r"(val));hi+=inc;lo+=li;asm("":"+r"(hi),"+r"(lo));val=root_33pack_fixed<29-P>(hi,lo);asm("movbeq %1,%0":"=m"(*(unsigned char(*)[8])(dst+8)):"r"(val));hi+=inc;lo+=li;asm("":"+r"(hi),"+r"(lo));val=root_33pack_fixed<27-P>(hi,lo);asm("movbeq %1,%0":"=m"(*(unsigned char(*)[8])(dst+16)):"r"(val));hi+=inc;lo+=li;asm("":"+r"(hi),"+r"(lo));val=root_33pack_fixed<25-P>(hi,lo);asm("movbeq %1,%0":"=m"(*(unsigned char(*)[8])(dst+24)):"r"(val));hi+=inc;lo+=li;asm("":"+r"(hi),"+r"(lo));word+=16;res=word-1;dst[32]=(unsigned char)(res>>P);dst+=33;}
}
template<unsigned P>static inline void fixed_payload_run(unsigned char*&dst,uint64_t&res,uint64_t&word,uint64_t run_end){
const uint64_t inc=(UINT64_C(4)<<33)+4,li=UINT64_C(4)<<31;
__m256i hi=_mm256_add_epi64(_mm256_set1_epi64x(((word-1)<<33)|(word+1)),_mm256_setr_epi64x(0,inc,2*inc,3*inc));
__m256i lo=_mm256_add_epi64(_mm256_set1_epi64x((word+3)<<31),_mm256_setr_epi64x(0,li,2*li,3*li));
const __m256i hi_inc=_mm256_set1_epi64x(4*inc),lo_inc=_mm256_set1_epi64x(4*li),sl0=_mm256_setr_epi64x(31-P,29-P,27-P,25-P),sr0=_mm256_setr_epi64x(33+P,35+P,37+P,39+P),sl1=_mm256_setr_epi64x(23-P,21-P,19-P,17-P),sr1=_mm256_setr_epi64x(41+P,43+P,45+P,47+P),rev=_mm256_setr_epi8(7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8);
{
__m256i first=_mm256_or_si256(_mm256_sllv_epi64(hi,sl0),_mm256_srlv_epi64(lo,sr0));
if constexpr(P>=3&&P<6){first=_mm256_or_si256(_mm256_and_si256(first,_mm256_set_epi64x(-1,-1,-1,(UINT64_C(1)<<(64-P))-1)),_mm256_set_epi64x(0,0,0,res<<(64-P)));}
_mm256_storeu_si256((__m256i*)dst,_mm256_shuffle_epi8(first,rev));if constexpr(P>=6)dst[0]=(unsigned char)(res<<(8-P));hi=_mm256_add_epi64(hi,hi_inc);lo=_mm256_add_epi64(lo,lo_inc);
word+=16;res=word-1;dst[32]=(unsigned char)(res>>P);dst+=33;
}
const __m256i sl2=_mm256_setr_epi64x(15-P,13-P,11-P,9-P),sr2=_mm256_setr_epi64x(49+P,51+P,53+P,55+P);
while(word+48<=run_end){
__m256i a=_mm256_or_si256(_mm256_sllv_epi64(hi,sl0),_mm256_srlv_epi64(lo,sr0));hi=_mm256_add_epi64(hi,hi_inc);lo=_mm256_add_epi64(lo,lo_inc);
__m256i b=_mm256_or_si256(_mm256_sllv_epi64(hi,sl1),_mm256_srlv_epi64(lo,sr1));hi=_mm256_add_epi64(hi,hi_inc);lo=_mm256_add_epi64(lo,lo_inc);
__m256i c=_mm256_or_si256(_mm256_sllv_epi64(hi,sl2),_mm256_srlv_epi64(lo,sr2));hi=_mm256_add_epi64(hi,hi_inc);lo=_mm256_add_epi64(lo,lo_inc);
_mm256_storeu_si256((__m256i*)(dst+0),_mm256_shuffle_epi8(a,rev));_mm256_storeu_si256((__m256i*)(dst+32),_mm256_shuffle_epi8(b,rev));_mm256_storeu_si256((__m256i*)(dst+64),_mm256_shuffle_epi8(c,rev));
word+=48;res=word-1;uint16_t tail=__builtin_bswap16(uint16_t(res>>(P+8)));__builtin_memcpy(dst+96,&tail,2);dst[98]=(unsigned char)(res>>P);dst+=99;}
if constexpr(P<6){uint64_t tv=(word-1)>>P;
while(word+32<=run_end){
__m256i a=_mm256_or_si256(_mm256_sllv_epi64(hi,sl0),_mm256_srlv_epi64(lo,sr0));hi=_mm256_add_epi64(hi,hi_inc);lo=_mm256_add_epi64(lo,lo_inc);
__m256i b=_mm256_or_si256(_mm256_sllv_epi64(hi,sl1),_mm256_srlv_epi64(lo,sr1));hi=_mm256_add_epi64(hi,hi_inc);lo=_mm256_add_epi64(lo,lo_inc);
_mm256_storeu_si256((__m256i*)(dst+0),_mm256_shuffle_epi8(a,rev));_mm256_storeu_si256((__m256i*)(dst+32),_mm256_shuffle_epi8(b,rev));word+=32;res=word-1;tv+=(32u>>P);{uint16_t tail=__builtin_bswap16((uint16_t)tv);__builtin_memcpy(dst+64,&tail,2);}dst+=66;}
}else{
while(word+32<=run_end){
__m256i a=_mm256_or_si256(_mm256_sllv_epi64(hi,sl0),_mm256_srlv_epi64(lo,sr0));hi=_mm256_add_epi64(hi,hi_inc);lo=_mm256_add_epi64(lo,lo_inc);
__m256i b=_mm256_or_si256(_mm256_sllv_epi64(hi,sl1),_mm256_srlv_epi64(lo,sr1));hi=_mm256_add_epi64(hi,hi_inc);lo=_mm256_add_epi64(lo,lo_inc);
_mm256_storeu_si256((__m256i*)(dst+0),_mm256_shuffle_epi8(a,rev));_mm256_storeu_si256((__m256i*)(dst+32),_mm256_shuffle_epi8(b,rev));word+=32;res=word-1;uint16_t tail=__builtin_bswap16(uint16_t(res>>P));__builtin_memcpy(dst+64,&tail,2);dst+=66;}
}
while(word+16<=run_end){
__m256i a=_mm256_or_si256(_mm256_sllv_epi64(hi,sl0),_mm256_srlv_epi64(lo,sr0));hi=_mm256_add_epi64(hi,hi_inc);lo=_mm256_add_epi64(lo,lo_inc);
_mm256_storeu_si256((__m256i*)dst,_mm256_shuffle_epi8(a,rev));word+=16;res=word-1;dst[32]=(unsigned char)(res>>P);dst+=33;}
}

template<unsigned P>static inline void four_payload_words(unsigned char*&dst,uint64_t&res,uint64_t&word,unsigned&pending){
const uint64_t inc=(UINT64_C(4)<<33)+4,li=UINT64_C(4)<<31;
auto hi=_mm_add_epi64(_mm_set1_epi64x(((word-1)<<33)|(word+1)),_mm_set_epi64x(inc,0));
auto lo=_mm_add_epi64(_mm_set1_epi64x((word+3)<<31),_mm_set_epi64x(li,0));
auto v=_mm_or_si128(_mm_sllv_epi64(hi,_mm_set_epi64x(29-P,31-P)),_mm_srlv_epi64(lo,_mm_set_epi64x(35+P,33+P)));
if constexpr(P>=3&&P<6)v=_mm_or_si128(_mm_and_si128(v,_mm_set_epi64x(-1,(UINT64_C(1)<<(64-P))-1)),_mm_set_epi64x(0,res<<(64-P)));
_mm_storeu_si128((__m128i*)dst,_mm_shuffle_epi8(v,_mm_setr_epi8(7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8)));if constexpr(P>=6)dst[0]=(unsigned char)(res<<(8-P));
word+=8;res=word-1;if constexpr(P>=4)dst[16]=(unsigned char)(res>>(P-4));dst+=16+(P>=4);pending=(P+4)&7;}

template<unsigned P>static inline void tail2(unsigned char*&dst,uint64_t&res,unsigned&pending,uint64_t&word){
constexpr unsigned N=33;
constexpr uint64_t valid=[](){uint64_t v=0;for(unsigned p=1;p<=N;++p)if(N%p==0)v|=1ull<<p;return v;}();
uint64_t w2=word+3;
uint64_t hi=(res<<33)|(word+1);
asm("shldq %2, %1, %0":"+r"(hi):"r"(w2<<31),"i"(31-P):"cc");
uint64_t packed=__builtin_bswap64(hi);
__builtin_memcpy(dst,&packed,8);
if constexpr(P>=6)dst[8]=(unsigned char)((w2<<(62-P))>>56);
dst+=8+((P+2)>>3);
res=w2;pending=(P+2)&7;
word=w2+1;
}
template<unsigned P>static inline void tail12(unsigned char*&dst,uint64_t&res,uint64_t&word,unsigned&pending){
const __m256i rv9=_mm256_setr_epi8(7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1,0,15,14,13,12,11,10,9,8);
const uint64_t inc9=(UINT64_C(4)<<33)+4,li9=UINT64_C(4)<<31;
__m256i hi9=_mm256_add_epi64(_mm256_set1_epi64x(((word-1)<<33)|(word+1)),_mm256_setr_epi64x(0,inc9,2*inc9,3*inc9));
__m256i lo9=_mm256_add_epi64(_mm256_set1_epi64x((word+3)<<31),_mm256_setr_epi64x(0,li9,2*li9,3*li9));
__m256i v9=_mm256_or_si256(_mm256_sllv_epi64(hi9,_mm256_setr_epi64x(31-P,29-P,27-P,25-P)),_mm256_srlv_epi64(lo9,_mm256_setr_epi64x(33+P,35+P,37+P,39+P)));
if constexpr(P>=3&&P<6){v9=_mm256_or_si256(_mm256_and_si256(v9,_mm256_set_epi64x(-1,-1,-1,(UINT64_C(1)<<(64-P))-1)),_mm256_set_epi64x(0,0,0,res<<(64-P)));}
_mm256_storeu_si256((__m256i*)dst,_mm256_shuffle_epi8(v9,rv9));if constexpr(P>=6)dst[0]=(unsigned char)(res<<(8-P));
word+=12;res=word-1;if constexpr(P>=2)dst[24]=(unsigned char)(res>>((P+6)&7));dst+=24+((P+6)>>3);pending=(P+6)&7;
}
template<unsigned P>static inline void root_fusion_payload_run(unsigned char*&dst,uint64_t&res,unsigned&pending,uint64_t&word,uint64_t end){
 if(word+16<=end)fixed_payload_run<P>(dst,res,word,end);
 uint64_t rem=end-word;
 if(rem==12){tail12<P>(dst,res,word,pending);return;}
 if(rem==4){tail2<P>(dst,res,pending,word);return;}
 if(rem==8){four_payload_words<P>(dst,res,word,pending);return;}
 return;
}
template<unsigned N>size_t generate(unsigned char*out){static_assert(N>=3&&N<=33,"order");constexpr size_t len=size_t(1)<<(N-3);constexpr uint64_t valid=[](){uint64_t v=0;for(unsigned p=1;p<=N;++p)if(N%p==0)v|=1ull<<p;return v;}();unsigned char*dst=out;uint64_t word=0,res=0;unsigned pending=1;uint64_t root_mask=(UINT64_C(1)<<17)-1;uint64_t root_threshold=UINT64_C(1)<<17;bool done=false;if constexpr(len>=32){unsigned char*limit=out+(len/FRAC)-16;while(dst<=limit){if constexpr(N==33){if((word&3u)==0){if(word>=root_threshold){do{root_mask>>=1;root_threshold<<=1;}while(word>=root_threshold);}const uint64_t run_end=(word|root_mask)+1;switch(pending){case 0:root_fusion_payload_run<0>(dst,res,pending,word,run_end);break;case 1:root_fusion_payload_run<1>(dst,res,pending,word,run_end);break;case 2:root_fusion_payload_run<2>(dst,res,pending,word,run_end);break;case 3:root_fusion_payload_run<3>(dst,res,pending,word,run_end);break;case 4:root_fusion_payload_run<4>(dst,res,pending,word,run_end);break;case 5:root_fusion_payload_run<5>(dst,res,pending,word,run_end);break;case 6:root_fusion_payload_run<6>(dst,res,pending,word,run_end);break;case 7:root_fusion_payload_run<7>(dst,res,pending,word,run_end);break;}{uint64_t tz64;asm("tzcntq %1,%0":"=r"(tz64):"r"(word));unsigned tz=(unsigned)tz64;if(tz<17){word|=(word<<tz)>>33;}else{unsigned pp=33-tz;for(unsigned sh=pp;sh<33;sh*=2)word|=word>>sh;if((valid>>pp)&1)shortput<false>(dst,res,pending,word>>(33-pp),pp);}continue;}continue;}}if(step<N,false>(dst,res,pending,word)){done=true;break;}}}while(!done)done=step<N,true>(dst,res,pending,word);return dst-out;}
}
void debruijn(unsigned n,char*out){if(n!=33)__builtin_trap();if(debruijn_packed::generate<33>((unsigned char*)out)!=(size_t(1)<<(33-3)))__builtin_trap();out[0]=0;}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1212.141 ms1024 MB + 8 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2026-11-23 12:28:13 | Loaded in 1 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠