模板-常数优化

实用技巧

  1. 减少函数参数传递,开全局变量 血的教训

  2. memset 实在是太慢了!避免大数组的多次 memset,可以在程序的其他位置(如遍历)顺手将数组清空 血的教训

快速读入

1
2
3
4
5
6
7
8
9
void readint() {}
template<class T1, class ...T2>
void readint(T1 &i, T2&... rest){
i=0;char c;bool f=false;
while (!isdigit(c=getchar())) f=c=='-';
do i=(i<<3)+(i<<1)+c-'0'; while (isdigit(c=getchar()));
if (f) i=-i;
readint(rest...);
}

快速输出

1
暂无

Comments

Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×