#include <iostream>
using namespace std;
/*
void kiirmat(int s, int o, int *m)
{
for(int i=0;i<s;i++)
{
for(int j=0;j<o;j++)
cout<<m[i*s+j]<<"\t";
cout<<endl;
}
return;
}
*/
int main()
{
int n, m;
cin>>n>>m;
long long int a[n], b[m];
long long int mat[n+2][m+2]={0};
for(int i=0;i<n+2;i++)
for(int j=0;j<m+2;j++)
mat[i][j]=0;
for(int i=0;i<n;i++)
cin>>a[i];
for(int i=0;i<m;i++)
cin>>b[i];
for(int i=1;i<=n;i++)
{
for(int j=1;j<=m;j++)
mat[i][j]=a[i-1]*b[j-1];
}
/*
for(int i=0;i<n+2;i++)
{
for(int j=0;j<m+2;j++)
cout<<mat[i][j]<<"\t";
cout<<endl;
}
*/
int csucssz=0;
for(int i=1;i<n+1;i++)
for(int j=1;j<m+1;j++)
{
if(mat[i][j]>mat[i-1][j] && mat[i][j]>mat[i+1][j] && mat[i][j]>mat[i][j-1] && mat[i][j]>mat[i][j+1])
csucssz++;
}
cout<<csucssz;
return 0;
}
Subtask | Sum | Test | Verdict | Time | Memory | ||
---|---|---|---|---|---|---|---|
subtask1 | 0/0 | ||||||
1 | Accepted | 3ms | 1876 KiB | ||||
2 | Accepted | 3ms | 2068 KiB | ||||
subtask2 | 16/16 | ||||||
3 | Accepted | 32ms | 8636 KiB | ||||
4 | Accepted | 28ms | 8588 KiB | ||||
5 | Accepted | 21ms | 8760 KiB | ||||
6 | Accepted | 32ms | 8764 KiB | ||||
7 | Accepted | 32ms | 9016 KiB | ||||
8 | Accepted | 32ms | 9096 KiB | ||||
subtask3 | 33/33 | ||||||
9 | Accepted | 10ms | 18972 KiB | ||||
10 | Accepted | 13ms | 18864 KiB | ||||
11 | Accepted | 12ms | 17924 KiB | ||||
12 | Accepted | 3ms | 3760 KiB | ||||
13 | Accepted | 3ms | 3964 KiB | ||||
14 | Accepted | 3ms | 4180 KiB | ||||
15 | Accepted | 13ms | 19976 KiB | ||||
subtask4 | 0/51 | ||||||
16 | Runtime error | 163ms | 522440 KiB | ||||
17 | Runtime error | 163ms | 522204 KiB | ||||
18 | Runtime error | 204ms | 522180 KiB | ||||
19 | Accepted | 35ms | 12504 KiB | ||||
20 | Accepted | 34ms | 12532 KiB | ||||
21 | Runtime error | 162ms | 521948 KiB | ||||
22 | Runtime error | 204ms | 521932 KiB | ||||
23 | Runtime error | 208ms | 521888 KiB | ||||
24 | Runtime error | 164ms | 521880 KiB |