首页
Python
Java
前端
数据库
Linux
Chatgpt专题
开发者工具箱
bzoj1452专题
bzoj1452 【JSOI2009】Count
对每个颜色开一个二维树状数组。 时间复杂度O(qlognlogm),空间复杂度O(cnm)。 #include<cstdio>#include<cstring>int map[310][310],s[110][310][310],n,m;void add(int p,int x,int y,int k){for (int i=x;i<=n;i+=i&-i)for (i
阅读更多...
[bzoj1452][树状数组]Count
Description Input Output Sample Input 3 3 1 2 3 3 2 1 2 1 3 3 2 1 2 1 2 1 1 2 3 2 2 2 3 2 3 2 Sample Output 1 2 题解 二维树状数组 s[p][i][j]表示,以(1,1)为左上端点到(i,j)为右下端点的矩阵,共有多少个颜色p
阅读更多...