Submission #743221

# Submission time Handle Problem Language Result Execution time Memory
743221 2023-05-17T08:57:08 Z Sainen420 Rice Hub (IOI11_ricehub) C++17
17 / 100
1000 ms 1112 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
using pi = pair<int,int>;

int besthub(int R, int L, int X[], long long B)
{
  int ans=0,mi,cnt=0,l,r;
    long long int b = B;
    for(int i=0;i<R;i++){
        b=B;
        l=i;r=i;
        cnt=1;
        //EXPAND
        while(b>0){
            mi=2e9;
            //cout << r << ' ' << l << endl;
            if(l>=1){
                mi=min(abs(X[l-1]-X[i]),mi);
            }
            if(r<(L-1)){
                mi=min(mi,abs(X[r+1]-X[i]));
            }
            if(mi==2e9)break;
            if(b-mi < 0)break;
            else{
                cnt++;
                b-=mi;
                if(l>=1 && mi==abs(X[l-1]-X[i])){
                    l--;
                }else{
                    r++;
                }
            }
        }
        ans=max(cnt,ans);
    }
  return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 308 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 33 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 9 ms 484 KB Output is correct
2 Correct 12 ms 468 KB Output is correct
3 Execution timed out 1050 ms 1112 KB Time limit exceeded
4 Halted 0 ms 0 KB -