# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
550772 |
2022-04-19T07:13:05 Z |
Jomnoi |
Pairs (IOI07_pairs) |
C++17 |
|
22 ms |
1492 KB |
#include <bits/stdc++.h>
#define DEBUG false
using namespace std;
long long solve1(int N, int D, int M) {
vector <int> X(N + 1);
for(int i = 1; i <= N; i++) {
cin >> X[i];
}
sort(X.begin() + 1, X.end());
long long ans = 0;
for(int l = 1, r = 1; r <= N; r++) {
while(l < r and X[r] - X[l] > D) {
l++;
}
ans += r - l;
}
return ans;
}
long long solve2(int N, int D, int M) {
vector <int> X(N + 1, 0), Y(N + 1, 0);
return -1;
}
long long solve3(int N, int D, int M) {
return -1;
}
int main() {
cin.tie(nullptr)->sync_with_stdio(false);
int B, N, D, M;
cin >> B >> N >> D >> M;
if(B == 1) {
cout << solve1(N, D, M);
}
else if(B == 2) {
cout << solve2(N, D, M);
}
else if(B == 3) {
cout << solve3(N, D, M);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 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 |
212 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
13 ms |
1092 KB |
Output is correct |
2 |
Correct |
14 ms |
1108 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
1492 KB |
Output is correct |
2 |
Correct |
18 ms |
1480 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
19 ms |
1460 KB |
Output is correct |
2 |
Correct |
18 ms |
1492 KB |
Output is correct |
3 |
Correct |
22 ms |
1484 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 |
1 ms |
1108 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1108 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
1108 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
332 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 |
328 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |