#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(n);
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 |
305 ms |
34020 KB |
Output is correct |
7 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
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 |
305 ms |
34020 KB |
Output is correct |
7 |
Runtime error |
3 ms |
640 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |