답안 #783160

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
783160 2023-07-14T16:21:41 Z Minindu206 쌀 창고 (IOI11_ricehub) C++14
43 / 100
1000 ms 612 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<r;i++)
  {
    vector<int> cost;
    for(int j=0;j<r;j++)
      cost.push_back(abs(x[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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 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 1 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 14 ms 212 KB Output is correct
4 Correct 15 ms 328 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 3 ms 212 KB Output is correct
7 Correct 14 ms 340 KB Output is correct
8 Correct 9 ms 328 KB Output is correct
9 Correct 4 ms 312 KB Output is correct
10 Correct 4 ms 212 KB Output is correct
11 Correct 11 ms 324 KB Output is correct
12 Correct 11 ms 212 KB Output is correct
13 Correct 18 ms 324 KB Output is correct
14 Correct 18 ms 324 KB Output is correct
15 Correct 4 ms 212 KB Output is correct
16 Correct 4 ms 312 KB Output is correct
17 Correct 11 ms 324 KB Output is correct
18 Correct 13 ms 212 KB Output is correct
19 Correct 19 ms 332 KB Output is correct
20 Correct 17 ms 324 KB Output is correct
21 Correct 272 ms 396 KB Output is correct
22 Correct 271 ms 340 KB Output is correct
23 Correct 608 ms 396 KB Output is correct
24 Correct 601 ms 400 KB Output is correct
25 Correct 559 ms 340 KB Output is correct
26 Correct 603 ms 320 KB Output is correct
27 Correct 509 ms 404 KB Output is correct
28 Correct 511 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1074 ms 612 KB Time limit exceeded
2 Halted 0 ms 0 KB -