-
Notifications
You must be signed in to change notification settings - Fork 0
/
A.cpp
39 lines (38 loc) · 825 Bytes
/
A.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include<bits/stdc++.h>
#include<string>
using namespace std;
#define fastio ios_base::sync_with_stdio(false);cin.tie(NULL)
int main()
{
fastio;
long long t,n,m,i,j,ar,mx,ara[100][100];
cin>>t;
while(t--)
{
cin>>n>>m;
ar=INT_MAX;
mx=INT_MIN;
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
cin>>ara[i][j];
mx=max(mx,ara[i][j]);
}
}
for(i=1;i<=n;i++)
{
for(j=1;j<=m;j++)
{
if(ara[i][j]==mx)
{
long long tempx=max(i,n-i+1);
long long tempy=max(j,m-j+1);
ar=min(ar,tempx*tempy);
}
}
}
cout<<ar<<"\n";
}
return 0;
}