# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
583010 |
2022-06-24T17:06:01 Z |
snasibov05 |
Pairs (IOI07_pairs) |
C++14 |
|
64 ms |
6172 KB |
#include <bits/stdc++.h>
using namespace std;
int main() {
int b, n, d, m; cin >> b >> n >> d >> m;
vector<vector<int>> coord(n, vector<int>(b));
for (int i = 0; i < n; ++i) {
for (int j = 0; j < b; ++j) cin >> coord[i][j];
}
/*if (n <= 1000){
int ans = 0;
for (int i = 0; i < n; ++i){
for (int j = i+1; j < n; ++j){
int dist = 0;
for (int k = 0; k < b; ++k) dist += abs(coord[i][k] - coord[j][k]);
if (dist <= d) ans++;
}
}
cout << ans << "\n";
} else*/ if (b == 1){
int ans = 0;
vector<int> c(n);
for (int i = 0; i < n; ++i) c[i] = coord[i][0];
sort(c.begin(), c.end());
int r = 0;
for (int i = 0; i < n; ++i){
while (r < n-1 && c[r+1] - c[i] <= d) r++;
ans += r - i;
}
cout << ans << "\n";
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
212 KB |
Output is correct |
2 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
340 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
36 ms |
6168 KB |
Output is correct |
2 |
Incorrect |
31 ms |
6172 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
49 ms |
6152 KB |
Output is correct |
2 |
Incorrect |
45 ms |
6144 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
51 ms |
6148 KB |
Output is correct |
2 |
Correct |
49 ms |
6028 KB |
Output is correct |
3 |
Correct |
64 ms |
6160 KB |
Output is correct |
# |
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 |
38 ms |
5716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
50 ms |
5764 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
58 ms |
5676 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
2 ms |
340 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
50 ms |
5716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
52 ms |
5716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
55 ms |
5716 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |