蒟蒻中的蒟蒻
快读快写!!!(如果用快读会 TLE ,因为数据量小,全都用 cin 就可以过了)
inline int read()
{
char c = getchar();
int f = 1, sum = 0;
while(c < '0' || c > '9')
{
if(c == '-') f = -f;
c = getchar();
}
while(c >= '0' && c <= '9')
{
sum = (sum << 1) + (sum << 3) + (c ^ 48);
c = getchar();
}
return sum * f;
}
inline void write(int x)
{
if(x < 0) putchar('-'), x = (~x) + 1;
if(!x) return putchar('0'), void();
int stk[40], l;
while(x) stk[ ++ l] = x % 10, x /= 10;
while(l) putchar(stk[l -- ] + '0');
}
inline void write_ (int x)
{
write(x), putchar(' ');
}
inline void writeln(int x)
{
write(x), putchar('\n');
}超级卡常快读快写 (最后要 flush())
#define gc() (iS == iT && (iT = (iS = ibuf) + fread(ibuf, 1, 1 << 20, stdin), iS == iT) ? EOF : *iS++)
#define pc(x) ((oT - obuf == (1 << 20)) && (fwrite(obuf, 1, 1 << 20, stdout), oT = obuf), *oT++ = x)
namespace FastIO {
char ibuf[1 << 20], obuf[1 << 20], *iS = ibuf, *iT = ibuf, *oT = obuf;
template <typename _Tp> inline void read(_Tp &x) {
char c = gc(); x = 0; bool f = 0;
for(; !isdigit(c); c = gc()) f |= c == '-';
for(; isdigit(c); c = gc()) x = (x << 1) + (x << 3) + (c ^ 48);
f ? x = ~x + 1 : 1;
}
template <typename _Tp> inline void write(_Tp x) {
static int stk[40]; int tp = 0;
if(x < 0) pc('-'), x = ~x + 1;
do stk[++tp] = x % 10, x /= 10; while(x);
while(tp) pc(stk[tp--] + '0');
}
inline void read(char &c) { for(c = gc(); !isgraph(c); c = gc()); }
inline void read(string &x) { x.clear(); char c = gc(); while(!isgraph(c)) c = gc(); while(isgraph(c)) x.push_back(c), c = gc(); }
inline void write(const char c) { pc(c); }
inline void write(const string x) { for(const char &c : x) pc(c); }
inline void writesp() { pc(' '); }
inline void writeln() { pc('\n'); }
template <typename _Tp, typename ...Args> inline void read(_Tp &x, Args &...args) { read(x), read(args...); }
template <typename _Tp, typename ...Args> inline void write(_Tp x, Args ...args) { write(x), pc(' '), write(args...); }
template <typename _Tp> inline void writesp(_Tp x) { write(x), pc(' '); }
template <typename _Tp> inline void writeln(_Tp x) { write(x), pc('\n'); }
inline void flush() { fwrite(obuf, oT - obuf, 1, stdout); }
}
using namespace FastIO;关闭同步!!!
ios::sync_with_stdio(0);
cin.tie(0); cout.tie(0);卡时!!!
if((double)clock() / CLOCKS_PER_SEC > 0.95) return ;