# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
655435 | 2022-11-04T11:23:27 Z | PanTkd | Rice Hub (IOI11_ricehub) | C++14 | 89 ms | 340 KB |
#include "ricehub.h" #include <iostream> #include <cmath> typedef long long ll; using namespace std; int besthub(int R, int L, int X[], long long B) { for(ll i = R;i>=1;i--){ ll cost = 0; ll med = ((i-1)/2); ll l = i/2; ll r = (i+1)/2; for(ll j = 0;j<i;j++){ cost += abs(X[med]-X[j]); } if(cost<=B) return i; for(ll j = 0;j<=R-i;j++){ med++; cost += abs(j-med)*(X[med]-X[med-1]); cost -= abs(i-abs(j-med-1))*(X[med]-X[med-1]); cost += (X[med]-X[j+i-1]); cost -= abs(X[med-1]-X[j-1]); //med+=2; if(cost<=B)return i; } } return 1; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 212 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 89 ms | 340 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |