http://codeforces.com/gym/101628/problem/D
题意: 给一个n*m的矩阵,有一个探测器在矩阵上乱跑,给出T个记录,第i个记录表示i时刻探测器位置的变化情况,问你在T时刻后,最少要探测几个方块 才能确保找到这个探测器。
水题,瞎写即可。。。。。
#include<iostream>
#include<set>
#include<queue>
#include<vector>
#include<algorithm>
#include<cstdio>
#include<iomanip>
#include<map>
#define lson l,m,rt<<1
#define rson m+1,r,rt<<1
using namespace std;
int x[200];
int main() {
int lx=0,uy=0,rx=0,dy=0;
int ex=0,ey=0;
int n,m;
scanf("%d %d",&n,&m);
int T;
scanf("%d",&T);
char op[2];
while(T--) {
scanf("%s",op);
if(op[0]=='D') {
ey++;
dy=max(dy,ey);
} else if(op[0]=='C') {
ex++;
rx=max(rx,ex);
} else if(op[0]=='B') {
ex--;
lx=min(ex,lx);
} else {
ey--;
uy=min(ey,uy);
}
}
int h=dy-uy+1;
int w=rx-lx+1;
h=m-h;
w=n-w;
ex-=lx,ey-=uy;
cout<<(h+1)*(w+1)<<endl;
for(int i=ex; i<=ex+w; i++) {
for(int j=ey; j<=ey+h; j++) {
printf("%d %d\n",i+1,j+1);
}
}
}