Submission #788298

# Submission time Handle Problem Language Result Execution time Memory
788298 2023-07-20T05:08:09 Z mindiyak Rice Hub (IOI11_ricehub) C++14
0 / 100
587 ms 262144 KB
#include "ricehub.h"
#include <iostream>
#include <vector>
#include <set>

using namespace std;

#define ll long long

int besthub(int R, int L, int X[], long long B)
{
  ll ans = 0;
  vector<multiset<int>> pos(L+1,multiset<int>());
  for(ll i=0;i<R;i++){
    for(ll j=max((ll)0,X[i]-B);j<=min((ll)L,X[i]+B);j++){
      pos[j].insert(abs(X[i]-j));
    }
  }

  for(ll i=0;i<L;i++){
    ll sum = 0;
    ll counter = 0;
    for(ll j:pos[i]){
      sum += j;
      if(sum>B){
        ans = max(ans,counter);
      }
      counter++;
    }
  }
  // cout << ans << endl;
  return ans;
}

# 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 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 258 ms 79320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 587 ms 262144 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -