很丑
另一份代码
还没有。。。。
#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</