ZOJ 3528 Parterre
来源:互联网 发布:宝山区行知实验幼儿园 编辑:程序博客网 时间:2024/06/05 18:55
直接暴力枚举竟然过了.
#include <iostream>#include <cstdio>#include <cmath>#include <memory.h>using namespace std;const int maxn = 505;int mat[maxn][maxn], n, m, q;int cnt[maxn / 2];int main(){while (scanf("%d%d", &n, &m) == 2){memset(mat, 0, sizeof(mat));int bn = (int)ceil(min(n, m) / 2.0);for (int i = 1; i <= bn; ++i){int t;scanf("%d", &t);for (int j = i; j <= (n - i + 1); ++j){mat[j][i] = t;mat[j][m - i + 1] = t;}for (int j = i; j <= (m - i + 1); ++j){mat[i][j] = t;mat[n - i + 1][j] = t;}}scanf("%d",&q);while (q--){int l, r, t, b, maxc = 0, maxi = 0, maxv = 0,diff = 0;;scanf("%d%d%d%d", &t, &l, &b, &r);t++,l++,b++,r++;memset(cnt,0,sizeof(cnt));for (int i = t; i <= b; ++i){for (int j = l; j <= r; ++j){cnt[mat[i][j]]++;maxc = max(maxc, mat[i][j]);}}for (int i = 1; i <= maxc; ++i){if(cnt[i]){diff++;if(cnt[i] > maxv){maxv = cnt[i];maxi = i; }}}printf("%d %d %d\n", diff, maxi, maxv);}}}
- zoj 3528 Parterre
- ZOJ 3528 Parterre
- ZOJ 3528 Parterre
- ZOJ Monthly, August 2011 zoj 3528
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- ZOJ
- 致我们即将逝去的青春,文字控吧
- 递归获取文件夹文件列表
- 漫谈兼容内核之九:ELF映像的装入(二)
- SDIBT 1350 最小重量机器设计问题
- 数据挖掘领域十大挑战问题
- ZOJ 3528 Parterre
- 代码的坏味道之十 :Switch Statements(switch惊悚现身)
- 漫谈兼容内核之十:Windows的进程创建和映像装入
- uva11401 - Triangle Counting(数三角形)
- 漫谈兼容内核之十一:Windows DLL的装入和连接
- 串的计数--动态规划和高精度
- Nginx 防盗链接
- 漫谈兼容内核之十二:Windows的APC机制
- 子元素DIV不随父DIV的滚动条移动