Submission #1003124

#TimeUsernameProblemLanguageResultExecution timeMemory
1003124rahidilbayramliRice Hub (IOI11_ricehub)C++17
0 / 100
2 ms604 KiB
#include<bits/stdc++.h> #include "ricehub.h" #define ll long long #define ld long double #define vl vector<ll> #define vi vector<int> #define pii pair<int, int> #define pll pair<ll, ll> #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(), v.rend() #define f first #define s second #define pb push_back #define p_b pop_back using namespace std; int besthub(int R, int L, int X[], long long B) { int n = R, i; int h[n+5]; for(i = 1; i <= n; i++) h[i] = X[i-1]; int res = 0; for(i = 1; i <= n; i++) { int l = i, r = n, ans = i; while(l <= r) { int mid = (l + r) / 2; if(h[mid] - h[i] > B) r = mid - 1; else { ans = max(ans, mid); l = mid + 1; } } res = max(res, ans - i + 1); } return res; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...