摘要:
Problem - 3329 用pfs,将淹没时间调整回来,然后用并查集,时间倒序插入点。代码如下: 1 #include 2 #include 3 #include 4 #include 5 #include 6 7 using namespace std; 8 9 const int N = 111; 10 const int dx[4] = { -1, 0, 1, 0}; 11 const int dy[4] = { 0, -1, 0, 1}; 12 bool vis[N][N]; 13 int mat[N][N]; 14 15 typedef pai... 阅读全文
摘要:
Jan's LightOJ :: Problem 1269 - Consecutive Sum 题意是,求给定序列的中,子序列最大最小的抑或和。 做法就是用一棵Trie树,记录数的每一位是0还是1。查询的时候,如果求最大值,就尽量让高位是1,相反就尽量让高位是0。代码如下,1y: 1 #include 2 #include 3 #include 4 #include 5 6 using namespace std; 7 8 const int N = 55555; 9 const int M = 32;10 11 struct Node {12 int c[2];13 ... 阅读全文