# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
95255 |
2019-01-29T06:44:17 Z |
easrui |
Pairs (IOI07_pairs) |
C++14 |
|
4000 ms |
1964 KB |
#include <bits/stdc++.h>
using namespace std;
const int MN = 1e5+5;
int B,N,D,M,X[MN],Y[MN],Z[MN],cnt;
long long ans;
int main()
{
cin >> B >> N >> D >> M;
if(B==1) {
for(int i=0; i<N; i++)
cin >> X[i];
sort(X,X+N);
for(int i=0; i<N; i++) {
while(cnt<N && X[i]+D>=X[cnt])
cnt++;
ans += cnt-i-1;
}
cout << ans;
} else {
for(int i=0; i<N; i++)
cin >> X[i] >> Y[i] >> Z[i];
for(int i=0; i<N; i++) {
for(int j=i+1; j<N; j++) {
if(abs(X[i]-X[j])+abs(Y[i]-Y[j])+abs(Z[i]-Z[j])<=D)
ans++;
}
}
cout << ans;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
756 KB |
Output is correct |
2 |
Correct |
27 ms |
760 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
744 KB |
Output is correct |
2 |
Correct |
45 ms |
764 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
46 ms |
888 KB |
Output is correct |
2 |
Correct |
44 ms |
712 KB |
Output is correct |
3 |
Correct |
44 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
3 ms |
376 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4009 ms |
1116 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4021 ms |
1144 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4093 ms |
1400 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
376 KB |
Output is correct |
2 |
Correct |
3 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4093 ms |
1804 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4049 ms |
1784 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
4030 ms |
1964 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |