This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
int inalt[1505],oriz[1505];
int i,j,n,m1,val;
map <int,int> m2;
long long p;
int main()
{
ios_base :: sync_with_stdio(false);
cin.tie(0);
cin>>n>>m1;
for (i=1;i<=n;i++)
{
cin>>inalt[i];
}
for (j=1;j<=m1;j++)
{
cin>>oriz[j];
}
for (i=1;i<=m1;i++)
{
for (j=i+1;j<=m1;j++)
{
m2[oriz[j]-oriz[i]]++;
}
}
p=0;
for (i=1;i<=n;i++)
{
for (j=i+1;j<=n;j++)
{
val=inalt[j]-inalt[i];
p=p+m2[val];
}
}
cout<<p;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |