# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101107 | 2019-03-16T16:26:39 Z | ansol4328 | Rice Hub (IOI11_ricehub) | C++11 | 6 ms | 512 KB |
#include<stdio.h> typedef long long ll; int n; ll b; ll m[100005]; bool pos(int del) { int cnt=n-del; int hcnt=cnt/2; ll d=0; for(int i=1 ; i<=cnt/2 ; i++) d+=m[cnt-i+1]-m[i]; if(d<=b) return true; for(int i=1 ; i<=n-cnt ; i++) { int didx=i, aidx=i+cnt; d-=m[didx+hcnt]-m[didx]; d+=m[aidx]-m[aidx-hcnt]; if(d<=b) return true; } return false; } int besthub(int R, int L, int *X, long long B) { for(int i=1 ; i<=R ; i++) m[i]=X[i-1]; b=B; int st=0, fn=R, mid, res; while(st<=fn) { mid=(st+fn)>>1; if(pos(mid)) fn=mid-1, res=mid; else st=mid+1; } return R-res; }
Compilation message
# | 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 | 384 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 | 6 ms | 512 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |