提交记录 12485


用户 题目 状态 得分 用时 内存 语言 代码长度
wys test. 自定义测试 Accepted 100 851.102 ms 28 KB C++ 813 B
提交时间 评测时间
2020-04-11 17:19:50 2023-09-03 19:40:16
#include <stdio.h>
#include <stdint.h>
#include <x86intrin.h>
#include <algorithm>

uint64_t store[10000];
uint64_t *store_p = store;

int main() {
	const int N = 50000000;
	uint64_t last_tsc = __rdtsc();
	uint64_t cnt = 0;
	uint64_t tmp_tsc;
	uint64_t start_tsc = __rdtsc();
	for (int i = 0; i < N; i++) {
		__asm__ volatile ("mfence");
		tmp_tsc = __rdtsc();
		uint64_t diff = tmp_tsc - last_tsc;
		if (diff >= 3000) *(store_p++) = diff;
		last_tsc = tmp_tsc;
	}
	uint64_t total = last_tsc - start_tsc;
	printf("total %llu (%.6lf)\n", total, total / (double) N);
	printf("cnt %llu, N %d\n", cnt, N);
	std::sort(store, store_p);
	for (uint64_t *p = store; p != store_p; p++) {
		printf("%llu%c", *p, " \n" [(p - store) % 10 == 9]);
		total -= *p;
	}
	printf("\n");
	printf("total-without-int %llu\n", total);
}


CompilationN/AN/ACompile OKScore: N/A

Testcase #1851.102 ms28 KBAcceptedScore: 100


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