提交记录 17436


用户 题目 状态 得分 用时 内存 语言 代码长度
fstqwq mmmd1k. 测测你的双精度矩阵乘法-1k Accepted 100 580.681 ms 16416 KB C++ 706 B
提交时间 评测时间
2022-02-21 04:14:32 2022-02-21 04:14:36
#include <bits/stdc++.h>

#define idx(i, j) ((i) * n + (j))

double BB[1024 * 1024];
void matrix_multiply(int n, const double *A, const double *B, double *C) {
	memcpy(BB, B, sizeof(double) << 20);
	for (int i = 0; i < n; i++) for (int j = i + 1; j < n; j++) {
		std::swap(BB[idx(i, j)], BB[idx(j, i)]);
	}
	for (int i = 0; i < n; i++) {
		for (int j = 0; j < n; j++) {
			double sum0 = 0, sum1 = 0, sum2 = 0, sum3 = 0;
			for (int k = 0; k < n; k += 4) {
				sum0 += A[idx(i, k)] * BB[idx(j, k)];
				sum1 += A[idx(i, k + 1)] * BB[idx(j, k + 1)];
				sum2 += A[idx(i, k + 2)] * BB[idx(j, k + 2)];
				sum3 += A[idx(i, k + 3)] * BB[idx(j, k + 3)];
			}
			C[idx(i, j)] = sum0 + sum1 + sum2 + sum3;
		}
	}
}

CompilationN/AN/ACompile OKScore: N/A

Testcase #1580.681 ms16 MB + 32 KBAcceptedScore: 100


Judge Duck Online | 评测鸭在线
Server Time: 2024-12-05 10:29:13 | Loaded in 0 ms | Server Status
个人娱乐项目,仅供学习交流使用 | 捐赠