# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
509443 |
2022-01-14T05:47:10 Z |
blue |
Pairs (IOI07_pairs) |
C++17 |
|
18 ms |
1560 KB |
#include <iostream>
#include <vector>
#include <algorithm>
#include <vector>
#include <set>
using namespace std;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;
void solve_1()
{
int N, D, M;
cin >> N >> D >> M;
int X[N];
for(int i = 0; i < N; i++) cin >> X[i];
ll ans = 0;
sort(X, X+N);
int l = 0;
for(int r = 0; r < N; r++)
{
while(X[r] - X[l] > D) l++;
ans += r-l;
}
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 solve_3();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
312 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 |
980 KB |
Output is correct |
2 |
Correct |
11 ms |
972 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
16 ms |
1484 KB |
Output is correct |
2 |
Correct |
16 ms |
1444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
1428 KB |
Output is correct |
2 |
Correct |
17 ms |
1556 KB |
Output is correct |
3 |
Correct |
18 ms |
1560 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
324 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 |
324 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 |
312 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
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 |
1 ms |
328 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |