#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll h, v, x[10005], y[10005], ans = 0;
set <ll> sy;
map <ll, ll> mp;
int main() {
ios_base::sync_with_stdio(NULL); cin.tie(nullptr); cout.tie(nullptr);
cin >> h >> v;
for(int i = 1; i <= h; i++) {
cin >> y[i];
}
for(int i = 1; i <= v; i++) {
cin >> x[i];
}
for(int i = 1; i < h; i++) {
for(int j = i + 1; j <= h; j++) {
sy.insert(y[j] - y[i]);
}
}
for(int i = 1; i < v; i++) {
for(int j = i + 1; j <= v; j++) {
mp[x[j] - x[i]]++;
}
}
for(auto u: sy) {
if(mp[u]) ans += mp[u];
}
cout << ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
146 ms |
31256 KB |
Output is correct |
7 |
Correct |
154 ms |
31116 KB |
Output is correct |
8 |
Correct |
177 ms |
31236 KB |
Output is correct |
9 |
Correct |
134 ms |
30268 KB |
Output is correct |
10 |
Incorrect |
10 ms |
852 KB |
Output isn't correct |
11 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
0 ms |
212 KB |
Output is correct |
5 |
Correct |
0 ms |
212 KB |
Output is correct |
6 |
Correct |
146 ms |
31256 KB |
Output is correct |
7 |
Correct |
154 ms |
31116 KB |
Output is correct |
8 |
Correct |
177 ms |
31236 KB |
Output is correct |
9 |
Correct |
134 ms |
30268 KB |
Output is correct |
10 |
Incorrect |
10 ms |
852 KB |
Output isn't correct |
11 |
Halted |
0 ms |
0 KB |
- |