#include <bits/stdc++.h>
#define loop(i, a, b) for(long long i=a;i<b;i++)
#define pool(i, a, b) for(long long i=a-1;i>=b;i--)
#define fore(i, a) for(auto&& i:a)
#define ll long long
using namespace std;
ll a[1600], b[1600];
map<ll, ll> neki;
int main(){
ll h, v;cin >> h >> v;
loop(i, 0, h) cin >> a[i];
loop(i, 0, v) cin >> b[i];
loop(i, 0, h){
loop(j, 0, i){
neki[a[i]-a[j]]++;
}
}
ll ans=0;
loop(i, 0, v){
loop(j, 0, i){
ans+=neki[b[i]-b[j]];
}
}
cout << ans << endl;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
233 ms |
23032 KB |
Output is correct |
7 |
Correct |
212 ms |
22808 KB |
Output is correct |
8 |
Correct |
239 ms |
22776 KB |
Output is correct |
9 |
Correct |
230 ms |
22136 KB |
Output is correct |
10 |
Correct |
14 ms |
768 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
0 ms |
256 KB |
Output is correct |
3 |
Correct |
1 ms |
256 KB |
Output is correct |
4 |
Correct |
1 ms |
256 KB |
Output is correct |
5 |
Correct |
1 ms |
256 KB |
Output is correct |
6 |
Correct |
233 ms |
23032 KB |
Output is correct |
7 |
Correct |
212 ms |
22808 KB |
Output is correct |
8 |
Correct |
239 ms |
22776 KB |
Output is correct |
9 |
Correct |
230 ms |
22136 KB |
Output is correct |
10 |
Correct |
14 ms |
768 KB |
Output is correct |
11 |
Correct |
2339 ms |
141180 KB |
Output is correct |
12 |
Correct |
2246 ms |
141124 KB |
Output is correct |
13 |
Correct |
2267 ms |
140852 KB |
Output is correct |
14 |
Correct |
2375 ms |
139316 KB |
Output is correct |
15 |
Correct |
86 ms |
1400 KB |
Output is correct |