답안 #783159

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
783159 2023-07-14T16:20:07 Z Minindu206 쌀 창고 (IOI11_ricehub) C++14
17 / 100
1000 ms 340 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 cost[r];
  int ans = 0;
  for(int i=0;i<l;i++)
  {
    for(int j=0;j<r;j++)
      cost[j] = (abs(i - x[j]));
    sort(cost, cost + r);
    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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 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 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 0 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 308 KB Output is correct
2 Correct 14 ms 304 KB Output is correct
3 Execution timed out 1067 ms 212 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1063 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -