Submission #783157

# Submission time Handle Problem Language Result Execution time Memory
783157 2023-07-14T16:17:47 Z Minindu206 Rice Hub (IOI11_ricehub) C++14
17 / 100
1000 ms 744 KB
#include "ricehub.h"
#include<bits/stdc++.h>
#define ll long long
using namespace std;
int besthub(int r, int l, int x[], long long b)
{
  int ans = 0;
  for(int i=0;i<l;i++)
  {
    vector<int> cost;
    for(int j=0;j<r;j++)
      cost.push_back(abs(i - x[j]));
    sort(cost.begin(), cost.end());
    ll sum = 0;
    int cur = 0;
    while(sum < b)
    {
      if(cur >= r)
        break;
      sum += cost[cur];
      cur++;
    }
    if(sum > b)
      cur--;
    ans = max(ans, cur);
  }
  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 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 16 ms 212 KB Output is correct
2 Correct 17 ms 308 KB Output is correct
3 Execution timed out 1078 ms 212 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1053 ms 744 KB Time limit exceeded
2 Halted 0 ms 0 KB -