#include #include #include #include #include using namespace std; struct cat { int xc,yc,fr; int power; }; int fronts,dogs; int bonuses[101]; char maps[101][101][101]; int x[101],y[101]; vector < cat > cats; bool sr(cat xx, cat yy) { return xx.power > yy.power; } int main() { ios::sync_with_stdio(false); freopen("catsdogs.in","r",stdin); freopen("catsdogs.out","w",stdout); //scanf("%d %d",fronts,dogs); cin>>fronts>>dogs; for(int i=0; i>x[i]>>y[i]>>bonuses[i]; for(int i1=0; i1>a; for(int k = 0 ; k='0' && maps[i1][i2][i]<='9') { cat now; now.xc=i1; now.yc=i2; now.fr=i; now.power=(maps[i1][i2][i]-'0'); cats.push_back(now); } } } } int l = cats.size(); sort(cats.begin(),cats.end(),sr); //printf("%d\n",cats[0].power); for(int i=0;i