# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
483910 |
2021-11-01T10:24:55 Z |
blue |
Pairs (IOI07_pairs) |
C++17 |
|
17 ms |
1484 KB |
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
void solve_1()
{
int N, D, M;
cin >> N >> D >> M;
vector<int> A(N);
for(int i = 0; i < N; i++) cin >> A[i];
sort(A.begin(), A.end());
long long ans = 0;
int j = 0;
for(int i = 0; i < N; i++)
{
while(j+1 < N && A[j+1] - A[i] <= D)
j++;
ans += (j-i);
}
cout << ans << '\n';
}
void solve_2()
{
;
}
void solve_3()
{
;
}
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
int B;
cin >> B;
if(B == 1) solve_1();
else if(B == 2) solve_2();
else if(B == 3) solve_3();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
204 KB |
Output is correct |
2 |
Correct |
0 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
1092 KB |
Output is correct |
2 |
Correct |
12 ms |
1000 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
1484 KB |
Output is correct |
2 |
Correct |
16 ms |
1484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
1476 KB |
Output is correct |
2 |
Correct |
16 ms |
1468 KB |
Output is correct |
3 |
Correct |
15 ms |
1484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
324 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 |
0 ms |
332 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 |
204 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 |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
332 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 |
- |