别想太多。
https://www.luogu.com.cn/paste/d7q447lc
特别鸣谢用户 1063026 的快读快写
namespace FastIO{
#ifndef _WIN32
#define getchar getchar_unlocked
#define putchar putchar_unlocked
#endif
const int S = 20;
int szb; char buf[S];
int read(){
int s = 1; char ch = getchar();
for (; ch < '0' || ch > '9'; ch = getchar()) if (ch == '-') s = -1;
int x = 0;
for (; ch >= '0' && ch <= '9'; ch = getchar()) x = x * 10 + (ch ^ 48);
return s * x;
}
void write(long long x, char sep = '\n'){
if (x < 0) putchar('-'), x = -x;
do { buf[++szb] = x % 10 + '0', x /= 10; } while (x);
while (szb) putchar(buf[szb--]);
putchar(sep);
}
}
using namespace FastIO;AT_joisc2014_e
胡乱的记:
通过记:P10815 【模板】快速读入