#include<bits/stdc++.h>
using namespace std;
typedef pair<int,int>pii;
typedef long long ll;
typedef pair<ll,ll>pll;
typedef __int128 lll;
mt19937 rng(chrono::steady_clock::now().time_since_epoch().count());
const ll mod=1e9+7;
const ll mn=3e5+10;
ll a[mn],b[mn];
int main(){
ios::sync_with_stdio(false);
cin.tie(0);
int n,m;
cin>>n>>m;
for(int i=0;i<n;i++)cin>>a[i];
for(int i=0;i<m;i++)cin>>b[i];
map<ll,ll>ma;
for(int i=1;i<n;i++)for(int j=0;j<i;j++)ma[a[i]-a[j]]++;
ll ans=0;
for(int i=1;i<m;i++)for(int j=0;j<i;j++)ans+=ma[b[i]-b[j]];
printf("%lld",ans);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
194 ms |
22888 KB |
Output is correct |
7 |
Correct |
206 ms |
22776 KB |
Output is correct |
8 |
Correct |
190 ms |
22776 KB |
Output is correct |
9 |
Correct |
191 ms |
22264 KB |
Output is correct |
10 |
Correct |
13 ms |
768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
4 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
4 |
Correct |
5 ms |
384 KB |
Output is correct |
5 |
Correct |
5 ms |
384 KB |
Output is correct |
6 |
Correct |
194 ms |
22888 KB |
Output is correct |
7 |
Correct |
206 ms |
22776 KB |
Output is correct |
8 |
Correct |
190 ms |
22776 KB |
Output is correct |
9 |
Correct |
191 ms |
22264 KB |
Output is correct |
10 |
Correct |
13 ms |
768 KB |
Output is correct |
11 |
Correct |
2036 ms |
141212 KB |
Output is correct |
12 |
Correct |
2041 ms |
141096 KB |
Output is correct |
13 |
Correct |
2028 ms |
140992 KB |
Output is correct |
14 |
Correct |
2019 ms |
139256 KB |
Output is correct |
15 |
Correct |
85 ms |
1400 KB |
Output is correct |