#include <bits/stdc++.h>
#define int long long
#define rep(i,n) for(int i = 0; i < n; i++)
#define int long long
using namespace std;
signed main(){
int n, m;
cin>>n>>m;
vector<int>ver(n);
vector<int>hor(m);
rep(i,n){cin>>ver[i];}
rep(i,m){cin>>hor[i];}
map<int, int>vertDif;
map<int, int>horDif;
rep(i, n){
for(int j=i+1; j<n; j++){
vertDif[ver[j]-ver[i]]++;
}
}
rep(i, m){
for(int j=i+1; j<m; j++){
horDif[hor[j]-hor[i]]++;
}
}
int sum=0;
for(auto k : vertDif){
sum+=k.second*horDif[k.first];
}
cout<<sum;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 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 |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 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 |
234 ms |
34104 KB |
Output is correct |
7 |
Correct |
256 ms |
33944 KB |
Output is correct |
8 |
Correct |
300 ms |
34040 KB |
Output is correct |
9 |
Correct |
279 ms |
33040 KB |
Output is correct |
10 |
Correct |
12 ms |
976 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
256 KB |
Output is correct |
2 |
Correct |
1 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 |
234 ms |
34104 KB |
Output is correct |
7 |
Correct |
256 ms |
33944 KB |
Output is correct |
8 |
Correct |
300 ms |
34040 KB |
Output is correct |
9 |
Correct |
279 ms |
33040 KB |
Output is correct |
10 |
Correct |
12 ms |
976 KB |
Output is correct |
11 |
Correct |
3590 ms |
211380 KB |
Output is correct |
12 |
Correct |
2707 ms |
211208 KB |
Output is correct |
13 |
Correct |
2432 ms |
211168 KB |
Output is correct |
14 |
Correct |
3180 ms |
208756 KB |
Output is correct |
15 |
Correct |
109 ms |
1912 KB |
Output is correct |