M行,第i行一个整数表示第i天过后小A能看到的楼房有多少栋
//qscqesze
#include <cstdio>
#include <cmath>
#include <cstring>
#include <ctime>
#include <iostream>
#include <algorithm>
#include <set>
#include <vector>
#include <sstream>
#include <queue>
#include <typeinfo>
#include <fstream>
#include <map>
#include <stack>
typedef long long ll;
using namespace std;
//freopen("D.in","r",stdin);
//freopen("D.out","w",stdout);
#define sspeed ios_base::sync_with_stdio(0);cin.tie(0)
#define maxn 200001
#define mod 10007
#define eps 1e-9
int Res,Num;char C,CH[12];
//const int inf=0x7fffffff; //无限大
const int inf=0x3f3f3f3f;
/*
inline void P(int x)
{
Num=0;if(!x){putchar(‘0‘);puts("");return;}
while(x>0)CH[++Num]=x%10,x/=10;
while(Num)putchar(CH[Num--]+48);
puts("");
}
*/
//**************************************************************************************
inline ll read()
{
int x=0,f=1;char ch=getchar();
while(ch<‘0‘||ch>‘9‘){if(ch==‘-‘)f=-1;ch=getchar();}
while(ch>=‘0‘&&ch<=‘9‘){x=x*10+ch-‘0‘;ch=getchar();}
return x*f;
}
inline void P(int x)
{
Num=0;if(!x){putchar(‘0‘);puts("");return;}
while(x>0)CH[++Num]=x%10,x/=10;
while(Num)putchar(CH[Num--]+48);
puts("");
}
int n,m,sum,sz;
int a,b;
int num[maxn];
double k[maxn];
double maxv[maxn];
vector<double> see[500];
int l[500],r[500];
void makeblock()
{
memset(maxv,0,sizeof(maxv));
sz=sqrt((double)n*1.05);
for(sum=1;sum*sz<n;sum++)
{
l[sum]=(sum-1)*sz+1;
r[sum]=sum*sz;
for(int i=l[sum];i<=r[sum];i++) num[i]=sum;
}
l[sum]=sz*(sum-1)+1;
r[sum]=n;
for(int i=l[sum];i<=r[sum];i++) num[i]=sum;
}
void updata()
{
double aa=a,bb=b;
k[a]=bb/aa;
maxv[num[a]]=0;
see[num[a]].clear();
double tmp=0;
for(int i=l[num[a]];i<=r[num[a]];i++)
{
if(k[i]>maxv[num[a]])
{
maxv[num[a]]=k[i];
see[num[a]].push_back(k[i]);
}
}
}
void query()
{
int ans=0;
double tmp=0;
for(int i=1;i<=sum;i++)
{
if(!see[i].empty())
{
ans+=see[i].end()-upper_bound(see[i].begin(),see[i].end(),tmp);
tmp=max(tmp,maxv[i]);
}
}
P(ans);
}
int main()
{
n=read(),m=read();
makeblock();
while(m--)
{
scanf("%d%d",&a,&b);
updata();
query();
}
}