摘要: 树状数组套主席树维护DFS序 网上linux交不过,windows下测可以,linux下Re 大家打check用吧#include <cstdio>#include <cstring>#include <cstdlib>#include <cmath>#include <ctime>#include <iostream>#include <algorithm>#include <stack>#in... 阅读全文
posted @ 2013-04-23 14:54 SYFT 阅读(144) 评论(0) 推荐(0) 编辑
摘要: 若第i个和第j个野人相聚,则有P[ i ] * b + C[ i ] = P[ j ] * b + C[ j ] ( mod m )m为洞的个数,移项得( P[ i ] – P[ j ] ) * b + ( C[ j ] – C[ i ] ) * 1 == Gcd( 1 ,b )所以可以枚举洞的个数,然后快速检验是否可行#include <cstdio>#include <cstring>#include <cstdlib>#include <ctime>#include <cmath>#include <iostream> 阅读全文
posted @ 2013-04-23 07:17 SYFT 阅读(456) 评论(0) 推荐(1) 编辑