摘要:
#include #include #include #include using namespace std; int r(char c) { switch(c) { case '#': return 0; case '(': return 0; case '+': return 1; case '-'... 阅读全文
摘要:
使用并查集查找时,如果查找次数很多,那么使用朴素版的查找方式肯定要超时。比如,有一百万个元素,每次都从第一百万个开始找,这样一次运算就是10^6,如果程序要求查找个一千万次,这样下来就是10^13,肯定要出问题的。 这是朴素查找的代码,适合数据量不大的 int findx(int x) { int 阅读全文