답안 #717874

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
717874 2023-04-02T17:29:14 Z thimote75 쌀 창고 (IOI11_ricehub) C++14
68 / 100
103 ms 2248 KB
#include "ricehub.h"

#include <bits/stdc++.h>
#define num long long
#define inf 1e18

using namespace std;

int besthub(int R, int L, int X[], num B)
{
    int mxCount = 0;

    for (int idx = 0; idx < R; idx ++) {
      int left  = idx - 1;
      int right = idx + 1;

      num cost  = 0;
      int count = 1;
      while (true) {
        int dcl = left == -1 ? inf : abs(X[left]  - X[idx]);
        int dcr = right == R ? inf : abs(X[right] - X[idx]);

        if (min(dcl, dcr) + cost > B) break ;
        cost  += min(dcl, dcr);
        count ++;
        
        if (dcl <= dcr) left --;
        else right ++;
      }

      mxCount = max(count, mxCount);
    }

    return mxCount;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 308 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 308 KB Output is correct
# 결과 실행 시간 메모리 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
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 312 KB Output is correct
11 Correct 1 ms 256 KB Output is correct
12 Correct 1 ms 308 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 308 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 308 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 312 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 2 ms 312 KB Output is correct
25 Correct 2 ms 212 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 312 KB Output is correct
3 Correct 2 ms 212 KB Output is correct
4 Correct 2 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 312 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 2 ms 316 KB Output is correct
13 Correct 3 ms 212 KB Output is correct
14 Correct 4 ms 212 KB Output is correct
15 Correct 1 ms 312 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 4 ms 212 KB Output is correct
18 Correct 3 ms 212 KB Output is correct
19 Correct 5 ms 316 KB Output is correct
20 Correct 5 ms 212 KB Output is correct
21 Correct 4 ms 344 KB Output is correct
22 Correct 5 ms 340 KB Output is correct
23 Correct 77 ms 340 KB Output is correct
24 Correct 55 ms 324 KB Output is correct
25 Correct 103 ms 344 KB Output is correct
26 Correct 103 ms 340 KB Output is correct
27 Correct 29 ms 364 KB Output is correct
28 Correct 31 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 468 KB Output is correct
2 Correct 6 ms 468 KB Output is correct
3 Runtime error 14 ms 2248 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -