提交记录 110429


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_cc_v41_260924 1001. 测测你的排序 Wrong Answer 0 95.241 ms 24 KB C++17 1.01 KB
提交时间 评测时间
2026-09-29 08:38:50 2026-09-29 08:38:54
/* fh1 1001 WA PROBE -- bit-level structure of the judge's array.
   Returns TWO numbers in one mem_kb read (base 4 separators):
        pages = L + 4 * A
        L = |{ a[i] & 1 : i in [0,n) }|        (1 => the low bit is CONSTANT; 2 => it varies)
        A = popcount( AND over i of a[i] )     (bits that are 1 in EVERY element)
   mem_kb = 12 + 4*pages.  WA by construction.  `volatile` is load-bearing (§67). */
static volatile unsigned char vbuf[256*4096 + 4096] __attribute__((aligned(4096)));
void sort(unsigned *a, int n) {
  unsigned lo1 = 0, lo0 = 0;
  unsigned aor = 0xFFFFFFFFu, aand = 0;
  for (int i = 0; i < n; i++) { unsigned v = a[i]; lo1 |= (v & 1u); lo0 |= (~v & 1u); aor &= v; aand |= v; }
  int L = (int)lo1 + (int)lo0;              /* 1 if the low bit is constant, else 2 */
  int A = 0; { unsigned w = aor; while (w) { A += (int)(w & 1u); w >>= 1; } }   /* popcount(aor) */
  int pages = L + 4*A;
  for (int i = 0; i < pages; i++) vbuf[i*4096] = (unsigned char)i;
  a[0] = (unsigned)(L + A*7 + (int)(aand & 0u));
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #195.241 ms24 KBWrong AnswerScore: 0


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