Cod sursa(job #3283052)
| Utilizator | Data | 8 martie 2025 00:16:17 | |
|---|---|---|---|
| Problema | Plantatie | Scor | 50 |
| Compilator | cpp-64 | Status | done |
| Runda | Arhiva de probleme | Marime | 0.51 kb |
#include <bits/stdc++.h>
using namespace std;
ifstream fin("plantatie.in");
ofstream fout("plantatie.out");
int main() {
int n, m;
fin>>n>>m;
int a[501][501];
for(int i = 1; i<=n; ++i)
for(int j = 1; j<=n; ++j)
fin>>a[i][j];
int x, y, k, maxim;
for(int t = 0; t<m; ++t) {
fin>>x>>y>>k;
maxim = 0;
for(int i = x; i<x+k; ++i)
for(int j = y; j<y+k; ++j)
maxim = max(maxim, a[i][j]);
fout<<maxim<<endl;
}
return 0;
}