#include<bits/stdc++.h>
using namespace std;
int main(){
cin.tie(0)->sync_with_stdio(0);
int h, v; cin >> h >> v;
map<int, int> m, n;
vector<int> a(h), b(v);
for(int& i:a) cin >> i;
for(int& i:b) cin >> i;
for(int i=0; i<h; ++i) for(int j=i+1; j<h; ++j) ++m[a[j]-a[i]];
for(int i=0; i<v; ++i) for(int j=i+1; j<v; ++j) ++n[b[j]-b[i]];
int ans = 0;
for(auto& i:m) ans += i.second * n[i.first];
cout << ans << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 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 |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 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 |
166 ms |
25708 KB |
Output is correct |
7 |
Correct |
161 ms |
25592 KB |
Output is correct |
8 |
Correct |
163 ms |
25592 KB |
Output is correct |
9 |
Correct |
160 ms |
24952 KB |
Output is correct |
10 |
Correct |
10 ms |
768 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
384 KB |
Output is correct |
2 |
Correct |
0 ms |
384 KB |
Output is correct |
3 |
Correct |
0 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 |
166 ms |
25708 KB |
Output is correct |
7 |
Correct |
161 ms |
25592 KB |
Output is correct |
8 |
Correct |
163 ms |
25592 KB |
Output is correct |
9 |
Correct |
160 ms |
24952 KB |
Output is correct |
10 |
Correct |
10 ms |
768 KB |
Output is correct |
11 |
Correct |
2101 ms |
158580 KB |
Output is correct |
12 |
Correct |
2107 ms |
158456 KB |
Output is correct |
13 |
Correct |
1878 ms |
158788 KB |
Output is correct |
14 |
Correct |
1898 ms |
156664 KB |
Output is correct |
15 |
Correct |
93 ms |
1528 KB |
Output is correct |