<pre name="code" class="cpp">#include <algorithm>
#include <iostream>
#include <cstring>
#include <cstdio>
#include <map>
#include <set>
using namespace std;
typedef map<int, multiset<int> > def;
int n, m;
void pop( def &a, def &b, int k )
{
printf( "%d\n", a[k].size() );
for( multiset<int>::iterator i=a[k].begin();i!=a[k].end();i++ )
b[*i].erase( k );
a[k].clear();
}
int main()
{
int i, j, x, y;
while( scanf( "%d%d", &n, &m ), n+m )
{
def low, vol;
for( i=0;i<n;i++ )
{
scanf( "%d%d", &x, &y );
low[x].insert( y );
vol[y].insert( x );
}
for( i=0;i<m;i++ )
{
scanf( "%d%d", &x, &y );
if( x )
pop( vol, low, y );
else
pop( low, vol, y );
}
printf( "\n" );
}
return 0;
}
map hdu 4022 Bombing
最新推荐文章于 2020-01-18 18:08:40 发布