【Usaco2015 JAN】Cow Rectangles

这篇博客主要讨论了Usaco2015年一月比赛中的Cow Rectangles问题,作者表达了对自己代码风格的不满,认为代码写得不够美观,并连续多次提及这一主题。
摘要由CSDN通过智能技术生成

很丑

另一份代码

还没有。。。。

#include<cstdio>
#include<algorithm>
using namespace std;
const int maxm = 500 + 10;
const int maxn = 1000 + 10;
const int INF = 0xfffffff;
int pre[maxn][maxn], n, l, r, d, u;
char ch;
struct answer{
    int point, area;
}ans;
struct G{
    int x, y;
}Gsx[maxm];
int cnt, nowpoint;
void Readin(){
    scanf("%d", &n);
    int x, y;
    l = d = INF;
    u = r = -INF;
    for(int i = 1; i <= n; i ++){
        scanf("%d %d %c", &x, &y, &ch);
        x ++;
        y ++;
        if(ch == 'H')
            pre[y][x] ++;
        else
            Gsx[++ cnt] = (G){x, y};
        l = min(l, x);
        r = max(r, x);
        d = min(d, y);
        u = max(u, y);
    }
}
bool Cmpx(G a, G b){
    return a.x == b.x ? a.y < b.y : a.x < b.x;
}
void Init(){
    for(int i = d; i <= u; i ++)
        for(int j = l; j <= r; j ++)
            pre[i][j] += (pre[i][j - 1] + pre[i - 1][j] - pre[i - 1][j - 1]);
    sort(Gsx + 1, Gsx + cnt + 1, Cmpx);
    Gsx[cnt + 1] = (G){r + 1</
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值