# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
145019 | 2019-08-18T12:30:00 Z | mhy908 | Rice Hub (IOI11_ricehub) | C++14 | 5 ms | 632 KB |
#include <bits/stdc++.h> #include "ricehub.h" using namespace std; typedef long long LL; LL sum[100010]; int arr[100010]; int ans; int besthub(int n, int m, int x[], LL b) { int l=1, r; LL p=0; for(int i=0; i<n; i++)arr[i+1]=x[i]; for(int i=1; i<=n; i++)sum[i]=sum[i-1]+(LL)arr[i]; for(r=1; r<=n; r++){ while(l<=r){ int mid=(l+r)/2; LL temp=(LL)(mid-l+1)*(LL)arr[mid]-(LL)(sum[mid]-sum[l-1])+(LL)(sum[r]-sum[mid-1])-(LL)(r-mid+1)*(LL)arr[mid]; if(temp>b)break; ans=max(ans, r-l+1); l++; } } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Incorrect | 2 ms | 376 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 376 KB | Output is correct |
3 | Incorrect | 2 ms | 376 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 376 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 5 ms | 632 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |