蒟蒻的暴力
#include<bits/stdc++.h>
using namespace std;
int n,m,k;
const int M=505;
char mp[M][M];
int vis[M][M];
int main(){
ios::sync_with_stdio(false),cin.tie(0),cout.tie(0);
cin>>n>>m>>k;
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
mp[i][j]='.';
}
}
for(int i=1;i<=k;i++){
int x,y;
char c;
cin>>x>>y>>c;
if(x>1&&y>1){
mp[x][y]=c;
mp[x+1][y]=c;
mp[x+2][y]=c;
mp[x-1][y]=c;
mp[x-2][y]=c;
mp[x][y+1]=c;
mp[x][y+2]=c;
mp[x][y-1]=c;
mp[x][y-2]=c;
}
if(x==1&&y!=1){
mp[x][y]=c;
mp[x+1][y]=c;
mp[x+2][y]=c;
mp[x-1][y]=c;
//mp[x-2][y]=c;
mp[x][y+1]=c;
mp[x][y+2]=c;
mp[x][y-1]=c;
mp[x][y-2]=c;
}
if(x!=1&&y==1){
mp[x][y]=c;
mp[x+1][y]=c;
mp[x+2][y]=c;
mp[x-1][y]=c;
mp[x-2][y]=c;
mp[x][y+1]=c;
mp[x][y+2]=c;
mp[x][y-1]=c;
//mp[x][y-2]=c;
}
if(x==1&&y==1){
mp[x][y]=c;
mp[x+1][y]=c;
mp[x+2][y]=c;
mp[x-1][y]=c;
// mp[x-2][y]=c;
mp[x][y+1]=c;
mp[x][y+2]=c;
mp[x][y-1]=c;
//mp[x][y-2]=c;
}
}
for(int i=1;i<=n;i++){
for(int j=1;j<=m;j++){
cout<<mp[i][j];
}
cout<<'\n';
}
return 0;
}