#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;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
199 ms |
17272 KB |
Output is correct |
7 |
Correct |
190 ms |
17220 KB |
Output is correct |
8 |
Correct |
190 ms |
17144 KB |
Output is correct |
9 |
Correct |
185 ms |
16632 KB |
Output is correct |
10 |
Correct |
10 ms |
640 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
384 KB |
Output is correct |
2 |
Correct |
1 ms |
384 KB |
Output is correct |
3 |
Correct |
1 ms |
384 KB |
Output is correct |
4 |
Correct |
0 ms |
384 KB |
Output is correct |
5 |
Correct |
0 ms |
384 KB |
Output is correct |
6 |
Correct |
199 ms |
17272 KB |
Output is correct |
7 |
Correct |
190 ms |
17220 KB |
Output is correct |
8 |
Correct |
190 ms |
17144 KB |
Output is correct |
9 |
Correct |
185 ms |
16632 KB |
Output is correct |
10 |
Correct |
10 ms |
640 KB |
Output is correct |
11 |
Correct |
2240 ms |
106036 KB |
Output is correct |
12 |
Correct |
2197 ms |
105936 KB |
Output is correct |
13 |
Correct |
2201 ms |
105920 KB |
Output is correct |
14 |
Correct |
2168 ms |
104624 KB |
Output is correct |
15 |
Correct |
78 ms |
1144 KB |
Output is correct |