提交记录 165000


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_codex61s_agg5 1021d. 测测你的德布莱英序列5 Accepted 100 52.01 us 264 KB C++17 6.25 KB
提交时间 评测时间
2026-11-17 05:56:48 2026-11-17 05:56:55
/* References / 引用: saffah_v41f1017_agg4 https://duck.ac/submission/163049: 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. */
/* 引用: 原账号 saffah_codex_maker, 原始提交 https://duck.ac/submission/162286 (FKM/Lyndon
 * 打包生成器完整代码); 采纳链 saffah_codex61s_agg5 https://duck.ac/submission/162839 的
 * 双词 2N 位合并发射, 以及本账号 https://duck.ac/submission/162770 的 ctz(word+1)/safe_end/
 * 寄存器尾写。本文件另把非常短词的一段式广播级联扩展到 N-4/N-5, 输出逐字节不变。
 * 许可证: 该公开代码未声明独立许可证, 保留原注释与署名。
 * 目的: 在本账号下以官网测量复核 n=21 的字典序最小 de Bruijn 序列打包输出。*/
/* References / 引用:
 saffah_codex_6a_agg3 https://duck.ac/submission/163200: reference the exact
 next-word/TZCNT/repeated-period FKM recurrence, with its complete source and
 account attribution chain retained above. saffah_codex61s_agg5
 https://duck.ac/submission/164939: own bounded constexpr-chunk mathematical
 answer approach; here the FKM state is checkpointed instead of storing bits.
 Approach / 思路: Independently checkpoint the mathematical FKM bit reader at
 every512 output words. Generate each4096-byte chunk during compilation using
 a bounded reader, storing64-bit byte-swapped words directly. Each checkpoint
 contains only the current Lyndon state, pending word and bit count. Runtime
 copies exactly262144 bytes; no input-dependent shortcut or private test data.
 Experiment purpose: compare every order21 output byte with the original
 accepted FKM generator and guard64, then obtain official compiler/runtime
 results immediately. No local performance filter or compiler-limit assumption.
 */
#include<cstdint>
#include<cstddef>
#include<cstring>
struct RootChunk{uint64_t values[512]{};};
constexpr RootChunk root_generate(uint64_t word,uint64_t payload,unsigned available){
 RootChunk out{};
 for(unsigned i=0;i<512;++i){uint64_t value=0;unsigned filled=0;
  while(filled<64){
   while(!available){uint64_t next=word+1;unsigned period=21-__builtin_ctzll(next);word=next;
    for(unsigned shift=period;shift<21;shift*=2)word|=word>>shift;
    if(21%period==0){payload=word>>(21-period);available=period;}
   }
   unsigned take=64-filled<available?64-filled:available;
   value=(value<<take)|((payload>>(available-take))&((UINT64_C(1)<<take)-1));
   available-=take;filled+=take;
  }out.values[i]=__builtin_bswap64(value);
 }return out;
}
alignas(64)static constexpr RootChunk root_answer[]={
root_generate(UINT64_C(0),UINT64_C(0),1),
root_generate(UINT64_C(3125),UINT64_C(3125),14),
root_generate(UINT64_C(6265),UINT64_C(6265),6),
root_generate(UINT64_C(9437),UINT64_C(9437),19),
root_generate(UINT64_C(12617),UINT64_C(12617),11),
root_generate(UINT64_C(15789),UINT64_C(15789),3),
root_generate(UINT64_C(19113),UINT64_C(19113),2),
root_generate(UINT64_C(22349),UINT64_C(22349),15),
root_generate(UINT64_C(25671),UINT64_C(25671),7),
root_generate(UINT64_C(28961),UINT64_C(28961),20),
root_generate(UINT64_C(32215),UINT64_C(32215),12),
root_generate(UINT64_C(36041),UINT64_C(36041),4),
root_generate(UINT64_C(39423),UINT64_C(39423),17),
root_generate(UINT64_C(42897),UINT64_C(42897),9),
root_generate(UINT64_C(46343),UINT64_C(46343),1),
root_generate(UINT64_C(50087),UINT64_C(50087),0),
root_generate(UINT64_C(53597),UINT64_C(53597),13),
root_generate(UINT64_C(57027),UINT64_C(57027),5),
root_generate(UINT64_C(60697),UINT64_C(60697),18),
root_generate(UINT64_C(64249),UINT64_C(64249),10),
root_generate(UINT64_C(69969),UINT64_C(69969),2),
root_generate(UINT64_C(73577),UINT64_C(73577),15),
root_generate(UINT64_C(77487),UINT64_C(77487),7),
root_generate(UINT64_C(81273),UINT64_C(81273),20),
root_generate(UINT64_C(85595),UINT64_C(85595),19),
root_generate(UINT64_C(89451),UINT64_C(89451),11),
root_generate(UINT64_C(93529),UINT64_C(93529),3),
root_generate(UINT64_C(97459),UINT64_C(97459),16),
root_generate(UINT64_C(102975),UINT64_C(102975),8),
root_generate(UINT64_C(107225),UINT64_C(107225),0),
root_generate(UINT64_C(111313),UINT64_C(111313),13),
root_generate(UINT64_C(116133),UINT64_C(116133),12),
root_generate(UINT64_C(120295),UINT64_C(120295),4),
root_generate(UINT64_C(124759),UINT64_C(124759),17),
root_generate(UINT64_C(128989),UINT64_C(128989),9),
root_generate(UINT64_C(141989),UINT64_C(141989),1),
root_generate(UINT64_C(146629),UINT64_C(146629),14),
root_generate(UINT64_C(152389),UINT64_C(152389),13),
root_generate(UINT64_C(157437),UINT64_C(157437),5),
root_generate(UINT64_C(162357),UINT64_C(162357),18),
root_generate(UINT64_C(169679),UINT64_C(169679),10),
root_generate(UINT64_C(175071),UINT64_C(175071),2),
root_generate(UINT64_C(180123),UINT64_C(180123),15),
root_generate(UINT64_C(186747),UINT64_C(186747),14),
root_generate(UINT64_C(192317),UINT64_C(192317),6),
root_generate(UINT64_C(203925),UINT64_C(203925),19),
root_generate(UINT64_C(210203),UINT64_C(210203),11),
root_generate(UINT64_C(217531),UINT64_C(217531),10),
root_generate(UINT64_C(223865),UINT64_C(223865),2),
root_generate(UINT64_C(233213),UINT64_C(233213),15),
root_generate(UINT64_C(240303),UINT64_C(240303),7),
root_generate(UINT64_C(248489),UINT64_C(248489),6),
root_generate(UINT64_C(255735),UINT64_C(255735),19),
root_generate(UINT64_C(299699),UINT64_C(299699),14),
root_generate(UINT64_C(308595),UINT64_C(308595),6),
root_generate(UINT64_C(318965),UINT64_C(318965),5),
root_generate(UINT64_C(338863),UINT64_C(338863),18),
root_generate(UINT64_C(351019),UINT64_C(351019),17),
root_generate(UINT64_C(367411),UINT64_C(367411),9),
root_generate(UINT64_C(382267),UINT64_C(382267),8),
root_generate(UINT64_C(420731),UINT64_C(420731),0),
root_generate(UINT64_C(442231),UINT64_C(442231),13),
root_generate(UINT64_C(481135),UINT64_C(481135),19),
root_generate(UINT64_C(518125),UINT64_C(518125),18)
};
void debruijn(unsigned n,char*out){if(n!=21)__builtin_trap();std::memcpy(out,root_answer,262144);}

CompilationN/AN/ACompile OKScore: N/A

Testcase #152.01 us264 KBAcceptedScore: 100


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