POJ 2406题目最下面有一行提示:“This problem has huge input, use scanf instead of cin to avoid time limit exceed.”
联想起之前有几题树状数组的题目用cin经常超时,换成scanf后就能AC,看来cin与scanf的效率上还是有很大差别的。
看别人介绍说使用std::ios::sync_with_stdio可以消除iostream的输入输出缓存,可以节省很多时间(http://www.cnblogs.com/cszero/archive/2012/02/11/Zero0ne.html)