摘要: 这数据量和这时限,很显然暴力是最好的解法,预处理前缀和,n方复杂度秒过。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 const int N = 1001; 7 int a[N][N]; 8 int m, n, x,... 阅读全文
posted @ 2015-05-02 20:05 hxy_has_been_used 阅读(141) 评论(0) 推荐(0) 编辑
摘要: 方法1:块状链表PS:块状链表太强大了,也可以实现和线段树一样的lazy操作来提高效率。每个块维护自己块的信息,这个题中可以考虑每个块维护一个map来记录每个颜色在区间中出现了多少次。 1 #include 2 #include 3 #include 4 #include 5 #i... 阅读全文
posted @ 2015-05-02 16:12 hxy_has_been_used 阅读(258) 评论(0) 推荐(0) 编辑
摘要: 经典的线段树题目,也可以用块链来做。 1 #include 2 #include 3 #include 4 #include 5 using namespace std; 6 7 typedef __int64 ll; 8 const ll M = 400; 9 ll b... 阅读全文
posted @ 2015-05-02 10:10 hxy_has_been_used 阅读(188) 评论(0) 推荐(0) 编辑