Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- int main(){
- int n, l, i, pos;
- cin >> n >> l;
- std::vector<int> a(l+1, 0);
- for(i=0; i<n; i++){
- cin >> pos;
- a[pos] = 1;
- }
- double r_max = 0;
- int j;
- for(i=0; i<=l; i++){
- if(a[i] == 1){
- double r = 0;
- for(j=1; j<=i; j++){
- if(a[i-j] != 1) r++;
- else r = r/2;
- if(r > r_max) r_max = r;
- }
- }
- }
- cout << r_max << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement