#include<bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
ll h, v, x[10005], y[10005], ans = 0;
set <ll> sx, sy;
int main() {
cin >> h >> v;
for(int i = 1; i <= h; i++) {
cin >> y[i];
}
for(int i = 1; i <= v; i++) {
cin >> x[i];
}
for(int i = 1; i < h; i++) {
for(int j = i + 1; j <= h; j++) {
sy.insert(y[j] - y[i]);
}
}
for(int i = 1; i < v; i++) {
for(int j = i + 1; j <= v; j++) {
sx.insert(x[j] - x[i]);
}
}
for(auto u: sx) {
for(auto v: sy) {
if(u == v) ans++;
}
}
cout << ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Execution timed out |
4088 ms |
17152 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
3 |
Correct |
0 ms |
212 KB |
Output is correct |
4 |
Correct |
1 ms |
212 KB |
Output is correct |
5 |
Correct |
1 ms |
212 KB |
Output is correct |
6 |
Execution timed out |
4088 ms |
17152 KB |
Time limit exceeded |
7 |
Halted |
0 ms |
0 KB |
- |