# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
874464 |
2023-11-17T06:19:21 Z |
josanneo22 |
Pairs (IOI07_pairs) |
C++17 |
|
18 ms |
1700 KB |
/*
Problem: IOI 2007 Pairs
When: 2023-11-16 14:54:19
Author: Ning07
*/
#include<bits/stdc++.h>
using namespace std;
using i64=long long;
const int NN=2e5;
int N,B,M,D,a[NN];
void solve1(){
for(int i=0;i<N;i++){
std::cin>>a[i];
}
sort(a,a+N);
i64 ans=0;
for(int i=0;i<N;i++){
int lst=lower_bound(a,a+N,a[i]-D)-a;
ans+=i-lst;
}
cout<<ans<<'\n';
}
void solve2(){
}
void solve3(){
}
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr); cout.tie(nullptr);
std::cin>>B>>N>>D>>M;
if(B==1) solve1();
else if(B==2) solve2();
else if(B==3) solve3();
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
11 ms |
1116 KB |
Output is correct |
2 |
Correct |
11 ms |
1204 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
18 ms |
1492 KB |
Output is correct |
2 |
Correct |
14 ms |
1628 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
17 ms |
1624 KB |
Output is correct |
2 |
Correct |
16 ms |
1624 KB |
Output is correct |
3 |
Correct |
15 ms |
1700 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
496 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
352 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |