#include <iostream>
#include <vector>
#include <map>
using namespace std;
int main() {
int H, V;
cin >> H >> V;
vector<int> A(H), B(V);
for (int i=0; i<H; ++i) cin >> A[i];
for (int i=0; i<V; ++i) cin >> B[i];
map<int,int> cnt;
for (int i=0; i<H; ++i) for (int j=0; j<i; ++j) cnt[ A[i]-A[j] ]++;
long long res = 0;
for (int i=0; i<V; ++i) for (int j=0; j<i; ++j) res += cnt[ B[i]-B[j] ];
cout << res << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
227 ms |
17272 KB |
Output is correct |
7 |
Correct |
226 ms |
17144 KB |
Output is correct |
8 |
Correct |
224 ms |
17144 KB |
Output is correct |
9 |
Correct |
316 ms |
16676 KB |
Output is correct |
10 |
Correct |
23 ms |
636 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
256 KB |
Output is correct |
6 |
Correct |
227 ms |
17272 KB |
Output is correct |
7 |
Correct |
226 ms |
17144 KB |
Output is correct |
8 |
Correct |
224 ms |
17144 KB |
Output is correct |
9 |
Correct |
316 ms |
16676 KB |
Output is correct |
10 |
Correct |
23 ms |
636 KB |
Output is correct |
11 |
Correct |
2453 ms |
106024 KB |
Output is correct |
12 |
Correct |
2453 ms |
105824 KB |
Output is correct |
13 |
Correct |
2317 ms |
105948 KB |
Output is correct |
14 |
Correct |
2350 ms |
104460 KB |
Output is correct |
15 |
Correct |
181 ms |
1144 KB |
Output is correct |