标签:val printf ace 模版 logs stream using lower pre
set使用实例1+lower_bound(val):
1 #include<stdio.h> 2 #include<set> 3 #include<iostream> 4 #include<algorithm> 5 #include<string.h> 6 #include<map> 7 using namespace std; 8 int main() 9 { 10 int n; 11 while(~scanf("%d",&n)) 12 { 13 map<int ,int>lson,rson; 14 set<int >s; 15 set<int >::iterator pos; 16 for(int i=0;i<n;i++) 17 { 18 int x; 19 scanf("%d",&x); 20 if(i==0) 21 { 22 s.insert(x); 23 continue; 24 } 25 pos=s.lower_bound(x); 26 if(pos!=s.end()&&lson[*pos]==0) 27 { 28 lson[*pos]=x; 29 } 30 else 31 { 32 pos--; 33 rson[*pos]=x; 34 } 35 printf("%d ",*pos); 36 s.insert(x); 37 } 38 printf("\n"); 39 } 40 }
set使用实例1+lower_bound(val)(个人模版)
标签:val printf ace 模版 logs stream using lower pre
原文地址:http://www.cnblogs.com/ECJTUACM-873284962/p/6562244.html