Cod sursa(job #2764306)

Utilizator Vlad_Popescu123Popescu Vlad Vlad_Popescu123 Data 20 iulie 2021 12:50:43
Problema Plantatie Scor 50
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.58 kb
#include <bits/stdc++.h>
using namespace std;
ifstream f("plantatie.in");
ofstream g("plantatie.out");
int main()
{
    long long n, m, d[501][501];
    f >> n >> m;

    for(int i = 1; i<= n; i++){
        for(int j = 1; j<= n; j++){
            f >> d[i][j];
        }
    }

    for(int k = 1; k<= m; k++){
        long long maxNr = 0, a,b ,c;
        f >> a >> b >> c;
        for(int i = a; i<= a + c - 1; i++){
            for(int j = b; j <= b+c -1; j++){
                maxNr = max(maxNr, d[i][j]);
            }
        }

        g << maxNr << "\n";
    }

}