zoj 3518 Unsafe Factor
来源:互联网 发布:hc05 编程 编辑:程序博客网 时间:2024/06/06 14:15
无语了都!!!会升还说我这个暴力!!刚搜题解!!有个用纯模拟过的!!!神呐!!!
我离散化了下 = =。。。没啥好说的。线段树不会。
#include <queue>#include <stack>#include <math.h>#include <stdio.h>#include <stdlib.h>#include <iostream>#include <limits.h>#include <string.h>#include <string>#include <algorithm>using namespace std;const int MAX = 10000010;const int N = 400010;struct LL{ int x,y,c;};LL b[N];int a[N];bool col[MAX];bool ans[MAX];int mmax;void solve(int n,int cnt,int nn){for(int i=0; i<n; i++){int x = lower_bound(a,a+cnt,b[i].x) - a;int y = lower_bound(a,a+cnt,b[i].y) - a;for(int k=x; k<y; k++){if( col[k] == true )col[k] = false;elsecol[k] = true;}}for(int i=0; i<cnt-1; i++)if( col[i] ){for(int k=a[i]; k<a[i+1]; k++)ans[k] = true;}int sum = 0;mmax = 0;for(int i=0; i<nn+1; i++)if( ans[i] )sum++;else{if( sum > mmax ) mmax = sum;sum = 0;}if( sum > mmax ) mmax = sum;}int main(){int n,cnt,n1,n2;while( ~scanf("%d",&n) ){memset(ans,false,sizeof(ans));memset(col,false,sizeof(col));cnt = 0;scanf("%d%d",&n1,&n2);for(int i=0; i<n1+n2; i++){scanf("%d%d",&b[i].x,&b[i].y);b[i].y++;a[cnt++] = b[i].x; a[cnt++] = b[i].y;}sort(a,a+cnt);cnt = unique(a,a+cnt) - a;solve(n1+n2,cnt,n);if( mmax == 0 )printf("0\n");elseprintf("%d\n",mmax);}return 0;}
- zoj 3518 Unsafe Factor
- ZOJ 3518 Unsafe Factor
- ZOJ-#3518 Unsafe Factor(模拟+Hash)
- ZOJ 3518 Unsafe Factor(离散化)
- ZOJ 3518 Unsafe Factor(区间覆盖:离散化)
- ZOJ3518 Unsafe Factor
- Counting Factor Trees zoj 3405
- zoj 4013 Counting Factor Trees
- ZOJ Problem Set - 3405 Counting Factor Trees
- Unsafe
- Unsafe
- Unsafe
- zoj 3518
- CLUSTERING FACTOR
- factor因子
- Hakan factor
- Krypton Factor
- The Factor
- Oracle数据库中灵活管理用户表空间配额
- zoj 3516 Tree of Three
- java 中使用接口的好处
- 知道怎么得到CSDN 资源分了
- 内存的释放--托管与非托管
- zoj 3518 Unsafe Factor
- 读取Assets目录下的文件
- 中国程序员的缺点
- 月光博客 (附源码 )
- 黑马程序猿-lesson8APPLET
- UBUNTU开启TELNET服务
- Windows下利用Cygwin平台下载android源代码
- struts2标签中使用el导致错误
- flex国际化