1:輸入最佳化
read
ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
namespace io{
const ll BUFSIZE=1<<20;
char ibuf[BUFSIZE],*is=ibuf,*it=ibuf;
char obuf[BUFSIZE],*os=obuf,*ot=obuf+BUFSIZE;
inline char getch(){
if(is==it)it=(is=ibuf)+fread(ibuf,1,BUFSIZE,stdin);
return (is==it)?EOF:*is++;
}
inline ll read(){
ll res=0;bool neg=false;char ch=getch();
while(!(isdigit(ch)||ch=='-')&&ch!=EOF)ch=getch();
if(ch=='-')neg=true,ch=getch();
while(isdigit(ch))res=res*10+(ch-'0'),ch=getch();
return neg?-res:res;
}
inline void flush(){
fwrite(obuf,1,os-obuf,stdout);
os=obuf;
}
inline void putch(char ch){
*os++=ch;
if(os==ot)flush();
}
inline void write(ll res){
char q[25];ll top;
if(res<0)putch('-'),res=-res;
if(res==0)putch('0');
top=0;
while(res)q[top++]=res%10+'0',res/=10;
while(top--)putch(q[top]);
}
}
2:O2最佳化
#pragma GCC optimize(1)
#pragma GCC optimize(2)
#pragma GCC optimize(3,"Ofast","inline")
暫時就更到這吧,以後有知道啥好用的再加