Submission #785051

# Submission time Handle Problem Language Result Execution time Memory
785051 2023-07-17T02:21:29 Z mindiyak Rice Hub (IOI11_ricehub) C++14
0 / 100
10 ms 468 KB
#include "ricehub.h"
#include <iostream>

using namespace std;

#define ll long long

int besthub(int R, int L, int X[], long long B)
{
  ll ans = 0;
  for(ll i=0;i<R;i++){
    ll temp_counter=0;
    ll temp_pos=0;
    ll cur_cost = 0;
    ll prev_pos = 0;
    for(ll j=i;j<R;j++){
      prev_pos = temp_pos;
      temp_pos = ((temp_pos * temp_counter) + X[j]) / (temp_counter+1);
      cur_cost += abs(prev_pos-temp_pos)*temp_counter;
      cur_cost += X[j] - temp_pos;
      temp_counter ++;
      if(cur_cost <= B){
        ans=max(ans,(j-i)+1);
      }else{
        break;
      }
      // cout << temp_counter << " " << temp_pos << " " << cur_cost << endl;
    }
  }
  // cout << ans << endl;
  return ans;
}

# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 1 ms 304 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 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 Correct 1 ms 212 KB Output is correct
4 Incorrect 1 ms 212 KB Output isn't correct
5 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 10 ms 468 KB Output isn't correct
2 Halted 0 ms 0 KB -