本文共 1372 字,大约阅读时间需要 4 分钟。
把一张海报剩余的部分分割成四个小矩形,然后就是简单的矩形面积并了。
//#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;typedef long long ll;typedef pair pii;#define pb(a) push_back(a)#define INF 0x1f1f1f1f#define lson idx<<1,l,mid#define rson idx<<1|1,mid+1,r#define PI 3.1415926535898template T min(const T& a,const T& b,const T& c) { return min(min(a,b),min(a,c));}template T max(const T& a,const T& b,const T& c) { return max(max(a,b),max(a,c));}void debug() {#ifdef ONLINE_JUDGE#else freopen("d:\\in.txt","r",stdin); // freopen("d:\\out1.txt","w",stdout);#endif}int getch() { int ch; while((ch=getchar())!=EOF) { if(ch!=' '&&ch!='\n')return ch; } return EOF;}const int maxn=201000;struct Seg{ int l,r,x; int c; Seg(){} Seg(int a,int b,int c,int d):l(a),r(b),x(c),c(d){} bool operator < (const Seg& another) const { return x =r) { flag[idx]+=v; PushUp(idx,l,r); return 0; } int mid=(r+l)>>1; if(tl<=mid)update(lson,tl,tr,v); if(tr>mid)update(rson,tl,tr,v); PushUp(idx,l,r); return 0;}int main(){ int n; while(scanf("%d",&n)!=EOF&&n) { int m=0; for(int i=0;i
转载于:https://www.cnblogs.com/BMan/p/3318906.html