#include <cstdint>
#include <cstdio>
#include <cstdlib>
#include <iostream>
#include <vector>
#include <deque>
#include <set>
#include <map>
#include <string>
#include <limits>
#include <assert.h>
#include <cmath>
#include <algorithm>
using namespace std;
using ll = long long int;
const ll mod = 998244353;
int main(){
cin.tie(0);
ios_base::sync_with_stdio(false);
int h, w;
cin >> h >> w;
vector<ll> hor(h), ver(w);
for(auto& i : hor){
cin >> i;
}
for(auto& i : ver){
cin >> i;
}
map<ll, ll> m;
for(int i = 0; i < h; ++i){
for(int j = i + 1; j < h; ++j){
++m[hor[j] - hor[i]];
}
}
ll answ = 0;
for(int i = 0; i < w; ++i){
for(int j = i + 1; j < w; ++j){
answ += m[ver[j] - ver[i]];
}
}
cout << answ << endl;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
153 ms |
22704 KB |
Output is correct |
7 |
Correct |
180 ms |
22736 KB |
Output is correct |
8 |
Correct |
222 ms |
22732 KB |
Output is correct |
9 |
Correct |
159 ms |
22000 KB |
Output is correct |
10 |
Correct |
12 ms |
628 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
3 |
Correct |
0 ms |
204 KB |
Output is correct |
4 |
Correct |
0 ms |
204 KB |
Output is correct |
5 |
Correct |
0 ms |
204 KB |
Output is correct |
6 |
Correct |
153 ms |
22704 KB |
Output is correct |
7 |
Correct |
180 ms |
22736 KB |
Output is correct |
8 |
Correct |
222 ms |
22732 KB |
Output is correct |
9 |
Correct |
159 ms |
22000 KB |
Output is correct |
10 |
Correct |
12 ms |
628 KB |
Output is correct |
11 |
Correct |
1872 ms |
140896 KB |
Output is correct |
12 |
Correct |
2100 ms |
140876 KB |
Output is correct |
13 |
Correct |
2080 ms |
140824 KB |
Output is correct |
14 |
Correct |
1946 ms |
139076 KB |
Output is correct |
15 |
Correct |
89 ms |
1300 KB |
Output is correct |