# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
55839 | 2018-07-09T05:43:53 Z | leejseo | Rice Hub (IOI11_ricehub) | C++ | 4 ms | 624 KB |
#include "ricehub.h" #include <algorithm> using namespace std; long long S[1000001]; inline long long val(int i){ return i<0? 0 : S[i]; } inline long long cost(int i, int j, int X[]){ int mid = i+j >> 1; long long left = val(mid) * (mid - i + 1) - (val(mid) - val(i-1)); long long right = val(j) - val(mid-1) - (val(mid) * (j - mid + 1)); return left + right; } int besthub(int R, int L, int X[], long long B){ S[0] = X[0]; for (int i=1; i<R; i++) S[i] = S[i-1] + X[i]; int ans = 0; int i=0, j=0; while (i < R && j < R){ if (cost(i, j, X) > B){ i++; continue; } ans = max(ans, j-i+1); if (j < R-1) j++; else i++; } return ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 264 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 488 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 488 KB | Output is correct |
2 | Incorrect | 2 ms | 488 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 4 ms | 624 KB | Output is correct |
2 | Incorrect | 4 ms | 624 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |