随笔分类 -  代码 科技

摘要:既好写又快的 pbds 哈希表 例题:P11615 【模板】哈希表 - 洛谷。 不想手写哈希表怎么办? unordered_map unordered_map 不能自己传入哈希函数,很容易被卡。 gp_hash_table gp_hash_table 是探查法,cc_hash_table 是拉链法, 阅读全文
posted @ 2025-08-14 22:40 dengchengyu 阅读(71) 评论(0) 推荐(1)
摘要:NOI Linux 2.0 竞赛环境食用指北 终端 使用 Ctrl+Alt+T 在当前登录用户的目录 ~ 中打开终端,也可以在文件夹中 右键 或 Shift+右键 在当前文件夹打开终端。 运行可执行文件需要加 ./,例如 ./<filename>。注意 Linux 中可执行文件是没有后缀名的。 mk 阅读全文
posted @ 2025-01-04 19:17 dengchengyu 阅读(203) 评论(0) 推荐(0)
摘要:使用 <chrono> 测量程序用时 & 生成随机种子 用 <chrono> 测量程序执行时间 头文件 <chrono>,命名空间 std::chrono。 chrono 中提供了三种获取当前时钟的命名空间的成员函数: chrono::system_clock::now(),系统时间,可能回退,可用 阅读全文
posted @ 2024-11-26 15:15 dengchengyu 阅读(346) 评论(0) 推荐(1)
摘要:各种内置函数技巧总结 数学库等 abs(x) 取绝对值,自动类型,注意没有 abs(__int128)。 (int)(x*100+0.5)/100.0 四舍五入保留两位小数。 printf("%.2lf",x) 以 double 类型输出 \(x\) 保留两位小数,有时不一定四舍五入。long do 阅读全文
posted @ 2024-11-16 16:54 dengchengyu 阅读(51) 评论(0) 推荐(0)
摘要:__gnu_pbds::tree 用法简介 太长不看版 每次操作的复杂度是 \(O(\log n)\)。 #include<ext/pb_ds/assoc_container.hpp> #include<ext/pb_ds/tree_policy.hpp> // or #include<bits/e 阅读全文
posted @ 2024-08-19 21:32 dengchengyu 阅读(470) 评论(0) 推荐(0)