【10.20更新】极致卡常:丧心病狂的缺省源
Skywalker2187 · · 闲话
声明:本文仅为极限卡常的产物,极难记忆、使用,如需正常缺省源,请前往如下文章:link
部分代码来自于OI-wiki
-
\tt{2024.10.20} - 更改了
getchar与putchar分别替换为getchar_unlocked与putchar_unlocked的替换规则,以保证g++在不同系统下均不会CE,且始终使用最快的读入方式
- 更改了
#ifndef _GLIBCXX_NO_ASSERT
#include <cassert>
#endif
#include <cctype>
#include <cerrno>
#include <cfloat>
#include <ciso646>
#include <climits>
#include <clocale>
#include <cmath>
#include <csetjmp>
#include <csignal>
#include <cstdarg>
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#if __cplusplus>=201103L
#include <ccomplex>
#include <cfenv>
#include <cinttypes>
#include <cstdalign>
#include <cstdbool>
#include <cstdint>
#include <ctgmath>
#include <cwchar>
#include <cwctype>
#endif
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <exception>
#include <fstream>
#include <functional>
#include <iomanip>
#include <ios>
#include <iosfwd>
#include <iostream>
#include <istream>
#include <iterator>
#include <limits>
#include <list>
#include <locale>
#include <map>
#include <memory>
#include <new>
#include <numeric>
#include <ostream>
#include <queue>
#include <set>
#include <sstream>
#include <stack>
#include <stdexcept>
#include <streambuf>
#include <string>
#include <typeinfo>
#include <utility>
#include <valarray>
#include <vector>
#if __cplusplus >= 201103L
#include <array>
#include <atomic>
#include <chrono>
#include <condition_variable>
#include <forward_list>
#include <future>
#include <initializer_list>
#include <mutex>
#include <random>
#include <ratio>
#include <regex>
#include <scoped_allocator>
#include <system_error>
#include <thread>
#include <tuple>
#include <typeindex>
#include <type_traits>
#include <unordered_map>
#include <unordered_set>
#endif
#ifdef _WIN32
#define getchar_unlocked getchar
#define putchar_unlocked putchar
#else
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
// #define x first
// #define y second
// #define mem(a,b) memset((a),(b),sizeof(a))
// constexpr int L=; // L!=1e9+10
typedef long long LL;
// typedef unsigned U;
// typedef std::pair<int,int> PII;
// typedef std::vector<int> VEC;
// typedef std::queue<int> QUE;
// typedef std::stack<int> STK;
// typedef std::set<int> SET;
// typedef std::map<int,int> MAP;
// typedef std::priority_queue<int,std::vector<int>,std::greater<int> > P_Q;
// typedef std::priority_queue<int,std::vector<int>,std::less<int> > _P_Q;
// typedef std::bitset<L> BS;
// typedef __int128 INT
// constexpr int N=;
// constexpr int M=;
// constexpr int inf=0x3f3f3f3f;
// constexpr int err=-1;
// constexpr double eps=1e-8;
// const double pi=acos(-1.0);
// constexpr int dx[]={0, 0, 1,-1, 1, 1,-1,-1};
// constexpr int dy[]={1,-1, 0, 0, 1,-1,-1, 1};
// constexpr LL mod=1e9+7;
#define I using
#define AK namespace
#define CSP_2024 std
I AK CSP_2024;
template<typename T>
void debug(string name="(NaN)",vector<T> v={-1})
{
cout<<"\n***"<<name<<"***\n";
for(typename vector<T>::const_iterator it=v.begin();it!=v.end();it++)
cout<<*it<<' ';
cout<<"\n****************\n";
}
// #define DEBUG 1// 调试开关
struct IO {
#define MAXSIZE (1 << 20)
#define isdigit(x) (x >= '0' && x <= '9')
char buf[MAXSIZE], *p1, *p2;
char pbuf[MAXSIZE], *pp;
#if DEBUG
#else
IO() : p1(buf), p2(buf), pp(pbuf) {}
~IO() { fwrite(pbuf, 1, pp - pbuf, stdout); }
#endif
char gc() {
#if DEBUG// 调试,可显示字符
return getchar_unlocked();
#endif
if (p1 == p2) p2 = (p1 = buf) + fread(buf, 1, MAXSIZE, stdin);
return p1 == p2 ? ' ' : *p1++;
}
bool blank(char ch) {
return ch == ' ' || ch == '\n' || ch == '\r' || ch == '\t';
}
template <class T>
void read(T &x) {
double tmp = 1;
bool sign = false;
x = 0;
char ch = gc();
for (; !isdigit(ch); ch = gc())
if (ch == '-') sign = 1;
for (; isdigit(ch); ch = gc()) x = x * 10 + (ch - '0');
if (ch == '.')
for (ch = gc(); isdigit(ch); ch = gc())
tmp /= 10.0, x += tmp * (ch - '0');
if (sign) x = -x;
}
void read(char *s) {
char ch = gc();
for (; blank(ch); ch = gc());
for (; !blank(ch); ch = gc()) *s++ = ch;
*s = 0;
}
void read(char &c) { for (c = gc(); blank(c); c = gc()); }
void push(const char &c) {
#if DEBUG// 调试,可显示字符
putchar_unlocked(c);
#else
if (pp - pbuf == MAXSIZE) fwrite(pbuf, 1, MAXSIZE, stdout), pp = pbuf;
*pp++ = c;
#endif
}
template <class T>
void write(T x) {
if (x < 0) x = -x, push('-');// 负数输出
static T sta[35];
T top = 0;
do {
sta[top++] = x % 10, x /= 10;
} while (x);
while (top) push(sta[--top] + '0');
}
template <class T>
void write(T x, char lastChar) {
write(x), push(lastChar);
}
} io;
inline void write_s(string s)
{
int len=s.size();
for(int i=0;i<s.size();i++)
putchar(s[i]);
}
signed main()
{
#ifndef ONLINE_JUDGE
freopen(".in","r",stdin);
freopen(".out","w",stdout);
#endif
return 0;
}