QAQ

P1578 奶牛浴场

你谷的神犇怎么这么强啊/kel
by Yangxiansen @ 2018-10-15 07:29:27


%%%![](http://www.wjyyy.top/wp-content/uploads/2018/07/QQ%E5%9B%BE%E7%89%8720180707073122.png)
by wjyyy @ 2018-10-15 07:38:09


```cpp #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #define N 5010 using namespace std; int l,w,n; struct node { int x,y; }pt[N]; int cmp(node a,node b) { if(a.x==b.x)return a.y<b.y; return a.x<b.x; } int cmp2(node a,node b) { if(a.y==b.y)return a.x<b.x; return a.y>b.y; } int main() { scanf("%d%d%d",&l,&w,&n); if(!n){printf("%d\n",l*w);return 0;} for(int i=1;i<=n;i++)scanf("%d%d",&pt[i].x,&pt[i].y); sort(pt+1,pt+n+1,cmp); int ans=-1; for(int i=1;i<=n;i++) { int u=w,d=0; for(int j=i+1;j<=n;j++) { ans=max(ans,(pt[j].x-pt[i].x)*(u-d)); if(pt[j].y>=pt[i].y)u=min(u,pt[j].y); if(pt[j].y<=pt[i].y)d=max(d,pt[j].y); } ans=max(ans,(l-pt[i].x)*(u-d)); } for(int i=n;i>=1;i--) { int u=w,d=0; for(int j=i-1;j>=1;j--) { ans=max(ans,(pt[i].x-pt[j].x)*(u-d)); if(pt[j].y>=pt[i].y)u=min(u,pt[j].y); if(pt[j].y<=pt[i].y)d=max(d,pt[j].y); } ans=max(ans,pt[i].x*(u-d)); } sort(pt+1,pt+n+1,cmp2); for(int i=1;i<n;i++) { ans=max(ans,(pt[i].y-pt[i+1].y)*l); } ans=max(ans,(w-pt[1].y)*l); ans=max(ans,pt[n].y*l); printf("%d\n",ans); } /*--------------------- 作者:wzq_QwQ 来源:CSDN 原文:https://blog.csdn.net/wzq_qwq/article/details/47167399?utm_source=copy 版权声明:本文为博主原创文章,转载请附上博文链接!*/ ``` 网上为数不多没有被你谷 $hack$ 掉的程序![](http://www.wjyyy.top/wp-content/uploads/2018/07/QQ%E5%9B%BE%E7%89%8720180707073122.png)
by Yangxiansen @ 2018-10-15 07:50:14


![/kel](http://www.wjyyy.top/wp-content/uploads/2018/07/QQ%E5%9B%BE%E7%89%8720180707073122.png)
by misinclair @ 2018-10-15 07:59:38


![](http://www.wjyyy.top/wp-content/uploads/2018/07/QQ%E5%9B%BE%E7%89%8720180707073122.png)
by 本居小铃 @ 2018-10-15 08:41:22


|