Submission #386304

# Submission time Handle Problem Language Result Execution time Memory
386304 2021-04-06T10:27:55 Z AmineTrabelsi Pairs (IOI07_pairs) C++14
30 / 100
58 ms 1644 KB
#include <bits/stdc++.h>
using namespace std;
long long solve_D(){
    int n,d,m;
    cin>>n>>d>>m;
    vector<int> a(n);
    for(auto &i:a)cin>>i;
        sort(a.begin(),a.end());
    int p = 0;
    long long res = 0;
    for(int i=0;i<n;i++){
        while(p < i && a[i]-a[p] > d)p++;
        res += i-p; 
    }
    return res;
}
int main(){
	int b;
    cin>>b;
    if(b == 1)cout<<solve_D()<<'\n';
    else cout<<"to do\n";
	return 0;
}
/*
1 6 5 100
10 20 23 25 50 50 
1

*/
# Verdict Execution time Memory Grader output
1 Correct 2 ms 492 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 35 ms 1152 KB Output is correct
2 Correct 30 ms 1152 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 57 ms 1516 KB Output is correct
2 Correct 54 ms 1520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 51 ms 1536 KB Output is correct
2 Correct 51 ms 1644 KB Output is correct
3 Correct 58 ms 1548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -