const int dy[]={1,0,-1};
const int dx[]={1,0,-1};
ll n,m,h,w;
string s;
map<pair<int,int>,ll> mp;
int x[100001],y[100001];
ll ans[10];
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
cout.precision(10);
cout<<fixed;
#ifdef LOCAL_DEFINE
FILE *stream1;
stream1=freopen("in","r",stdin);
if(stream1==NULL)return 0;
#endif
cin>>h>>w>>n;
for(int i=0;i<n;i++){
cin>>y[i]>>x[i];
x[i]--;y[i]--;
for(int j=-2;j<=0;j++){
for(int k=-2;k<=0;k++){
if(y[i]+j<0 || y[i]+j+2>=h)continue;
if(x[i]+k<0 || x[i]+k+2>=w)continue;
mp[make_pair(y[i]+j,x[i]+k)]++;
}
}
}
for(auto ite=mp.begin();ite!=mp.end();ite++){
ans[ite->se]++;
}
ans[0]=(w-2)*(h-2)-(int)mp.size();
println__(ans,ans+10);
#ifdef LOCAL_DEFINE
cerr<<"Time elapsed: "<<1.0*clock()/CLOCKS_PER_SEC<<"s.\n";
fclose(stream1);
#endif
return 0;
}
- 塗られた付近のデータだけ保存しとけば、残りは0個なのでね。