提交记录 117986


用户 题目 状态 得分 用时 内存 语言 代码长度
saffah_cc_v41_260924 mmms2k. 测测你的短整数矩阵乘法-2k Wrong Answer 0 2.675 ms 132 KB C++17 1.96 KB
提交时间 评测时间
2026-10-01 06:12:45 2026-10-01 06:12:46
#define PROBE 6
// mmms2k SHAPE PROBE.  §N948 device: encode a property of the judge's REAL input in the
// number of DIRTY PAGES touched; board mem_kb = 12 + 4*(pages_written).
// Interface (problem page): void matrix_multiply(int n, const short *A, const short *B, short *C);
// n = 2048; statement claims A,B entries are IID uniform over full int16 range, C compared mod 2^16.
#define MAXP 200000
static volatile unsigned char PG[(unsigned long long)MAXP * 4096];
static void touch(unsigned long long t){ if(t>MAXP) t=MAXP; for(unsigned long long i=0;i<t;i++) PG[i*4096]=(unsigned char)i; }
#ifndef PROBE
#define PROBE 0
#endif

void matrix_multiply(int n, const short *A, const short *B, short *C) {
  (void)A; (void)B; (void)C;
  long N = (long)n * (long)n;
  unsigned long long v = 0;
  long i;
  switch (PROBE) {
  case 0: v = 0; break;                       /* calibration: harness pages + time */
  case 1: { long c=0; for(i=0;i<N;i++){ int x=A[i]; if(x<-128||x>127) c++; } v=(unsigned long long)c>>12; } break;
  case 2: { long c=0; for(i=0;i<N;i++) if(A[i]==0) c++; v=(unsigned long long)c>>12; } break;
  case 3: { int m=0; for(i=0;i<N;i++){ int x=A[i]; if(x<0)x=-x-1; if(x>m)m=x; } v=(unsigned long long)m>>4; } break;
  case 4: { int m=0; for(i=0;i<N;i++){ int x=B[i]; if(x<0)x=-x-1; if(x>m)m=x; } v=(unsigned long long)m>>4; } break;
  case 5: { long c=0; for(i=0;i<N;i++) if(B[i]==0) c++; v=(unsigned long long)c>>12; } break;
  case 6: { long c=0; for(i=0;i<N;i++){ int x=A[i]; if(x<-32768+1000||x>32767-1000) c++; } v=(unsigned long long)c>>12; } break;
  case 7: { /* exact page calibration: touch exactly 2048 pages (C's own size) */
            v = 2048; } break;
  case 8: { /* full-range check on BOTH, and the count outside [-16384,16383] */
            long c=0; for(i=0;i<N;i++){ int x=A[i]; if(x<-16384||x>16383) c++; }
            for(i=0;i<N;i++){ int x=B[i]; if(x<-16384||x>16383) c++; }
            v=(unsigned long long)c>>13; } break;
  default: v = 0; break;
  }
  touch(v);
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #12.675 ms132 KBWrong AnswerScore: 0


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