标签:des style blog http color os java io strong
Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65768/65768 K (Java/Others)
Total Submission(s): 2650 Accepted Submission(s):
990
1 #include<iostream> 2 #include<cstdio> 3 #include<string> 4 #include<cstring> 5 #include<map> 6 #include<set> 7 #include <algorithm> 8 using namespace std; 9 10 int main(){ 11 int N,M,i,j,x,y; 12 while(scanf("%d%d",&N,&M)&&(N||M)){ 13 map<int,multiset<int> > row; 14 map<int,multiset<int> > col; 15 for(i=0;i<N;i++){ 16 scanf("%d%d",&x,&y); 17 row[x].insert(y); 18 col[y].insert(x); 19 } 20 for(i=0;i<M;i++){ 21 scanf("%d%d",&x,&y); 22 int ans=0; 23 if(x==0){ 24 printf("%d\n",row[y].size()); 25 for(multiset<int>::iterator itr=row[y].begin();itr!=row[y].end();itr++){ 26 col[*itr].erase(y); 27 } 28 row[y].clear(); 29 }else{ 30 printf("%d\n",col[y].size()); 31 for(multiset<int>::iterator itr=col[y].begin();itr!=col[y].end();itr++){ 32 row[*itr].erase(y); 33 } 34 col[y].clear(); 35 36 } 37 38 } 39 puts(""); 40 41 } 42 43 return 0; 44 }
标签:des style blog http color os java io strong
原文地址:http://www.cnblogs.com/imLPT/p/3941484.html