Submission
Status:
----------
Subtask/Task Score:
0/100
Score: 0
User: andamanlnwza007
Problemset: ผลรวมตัวเลข
Language: cpp
Time: 0.013 second
Submitted On: 2025-10-01 13:38:42
#include <iostream>
#include <string>
#include <algorithm>
using namespace std;
int main(){
int x,y,nop,px,py,pofp[nop][2],keep=0,check=0;
cin>>x>>ws>>y>>nop;
for (int i =0 ;i < nop;i++){
cin>>px>>ws>>py;
pofp[i][0]=px;
pofp[i][1]=py;
}
for (int i = 0 ; i<x ; i++){
for (int j =0 ; j<y ;j++){
for (int k = 0; k<nop ; k++){
px=pofp[k][0];
py=pofp[k][1];
if (j==py and i==px){
j+=1;
keep=0;
}
if ((i-1<=px and px<=i+1) and (j-1<=py and py<=j+1) and (j!=py or i!=px)){
keep+=1;
}
}
if (keep>check){
check=keep;
}
keep=0;
}
}
cout<<check;
}