# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
748846 |
2023-05-27T05:20:05 Z |
teerapat_ |
Pairs (IOI07_pairs) |
C++14 |
|
2 ms |
468 KB |
#include <iostream>
#include <cmath>
using namespace std;
int i, b, n, d, m;
long long answer, x, y , z, aux;
long double temp_aux;
long long px[101], py[101], pz[101];
int main() {
answer = 0;
cin >> b >> n >> d >> m;
if(b == 1){// 1D
for(i = 1; i <= n; i++){
cin >> x;
px[i] = x;
}
for(i = 1; i <= n; i++){
for(int j = i+1; j <= n; j++){
aux = abs(px[i] - px[j]);
if(aux <= d){
answer++;
}
}
}
}
else if (b == 2){// 2D
for(i = 1; i <= n; i++){
cin >> x >> y;
px[i] = x;
py[i] = y;
}
for(i = 1; i <= n; i++){
for(int j = i+1; j <= n; j++){
temp_aux = sqrt(pow(px[i] - px[j], 2) + pow(py[i] - py[j], 2));
aux = round(temp_aux);
if (temp_aux < aux) {
aux += 1;
}
if(aux <= d){
answer++;
}
}
}
}
else if (b == 3){// 3D
for(i = 1; i <= n; i++){
cin >> x >> y >> z;
px[i] = x;
py[i] = y;
pz[i] = z;
}
for(i = 1; i <= n; i++){
for(int j = i+1; j <= n; j++){
temp_aux = sqrt(pow(px[i] - px[j], 2) + pow(py[i] - py[j], 2) + pow(pz[i] - pz[j], 2));
aux = round(temp_aux);
if (temp_aux < aux) {
aux += 1;
}
if(aux <= d){
answer++;
}
}
}
}
cout << answer << endl;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
1 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
448 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
340 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
320 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
468 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |