随笔分类 - 算法竞赛
c++ 竞赛常用函数模板
摘要:三路快排 void Quicksort(int l, int r) { if (l >= r) return; int key = arr[rand() % (r - l + 1) + l]; int i = l, j = l, k = r; while (i <= k) { if (arr[i]
c++竞赛模板代码
摘要:#include <bits/stdc++.h> using namespace std; typedef long long ll; const int PRIME =122777; const int MOD =998244353; const int INF =0x3f3f3f3f; cons
关于C++中STL的简单入门(updating)
摘要:前言:本篇文章将对STL(标准模板库)进行一个简单的介绍,以方便在算法竞赛中节省时间并方便使用。 C++ STL(标准模板库)是一套功能强大的 C++ 模板类,提供了通用的模板类和函数,这些模板类和函数可以实现多种流行和常用的算法和数据结构,如向量、链表、队列、栈。 C++ 标准模板库的核心包括以下
C++ 快速读入 输出优化模板
摘要:前言 Method 1 关闭同步/解除绑定 std::ios::sync_with_stdio(false),std::cin.tie(0),cout(0); 原理:关闭同步流 ps. 此时cin cout与scanf同printf 会混乱,不要混用。 Method 2 快读、快写 template