跳到正文

违规用户名4M^ns%fl

336063

在洛谷打开
资料、奖项与版本

资料

编号
336063
抓取

另一个账号

͏͏͏͏͏͏͏͏͏͏͏͏͏͏͏快读板子

C++
// orz laofudasuan
// modified

namespace io {
	const int SIZE = (1 << 21) + 1;
	char ibuf[SIZE], *iS, *iT, obuf[SIZE], *oS = obuf, *oT = oS + SIZE - 1, c, qu[55]; int f, qr;
	// getchar
	#define gc() (iS == iT ? (iT = (iS = ibuf) + fread (ibuf, 1, SIZE, stdin), (iS == iT ? EOF : *iS ++)) : *iS ++)
	// print the remaining part
	inline void flush () {
		fwrite (obuf, 1, oS - obuf, stdout);
		oS = obuf;
	}
	// putchar
	inline void putc (char x) {
		*oS ++ = x;
		if (oS == oT) flush ();
	}
	// input a signed integer
	template <class I>
	inline void gi (I &x) {
		for (f = 1, c = gc(); c < '0' || c > '9'; c = gc()) if (c == '-') f = -1;
		for (x = 0; c <= '9' && c >= '0'; c = gc()) x = x * 10 + (c & 15); x *= f;
	}
	// print a signed integer
	template <class I>
	inline void print (I x) {
		if (!x) putc ('0'); if (x < 0) putc ('-'), x = -x;
		while (x) qu[++ qr] = x % 10 + '0',  x /= 10;
		while (qr) putc (qu[qr --]);
	}
	//no need to call flush at the end manually!
	struct Flusher_ {~Flusher_(){flush();}}io_flusher_;
}
using io :: gi;
using io :: putc;
using io :: print;

我事一个老菜狗(悲)

共 2 篇
  1. 个人记录

    NOIP2023退役记

    在我的博客上阅读 开考 早上起来睡得不错,不怎么困 8:00 多到考场,在七宝中学,他们在修路 进考场以后就是调机器等密码,拿到密码后开始干题目 T1 一眼大水题,半小时之后完成,过了大样例 T2 先写了一个暴力,然后开始考虑正解。发现经过所有的操作之后每个变量要么等于一个常量,…

  2. 个人记录

    线段树技巧:处理负数端点值

    当线段树端点值可取负数时,计算中点应使用 mid = ⌊ l+r-1/2 ⌋。若使用常规公式 ⌊ l+r/2 ⌋(C++ 整除向零取整),在负数区间(如 l=-2, r=-1)会导致 mid=r 从而引发死循环。