답안 #335595

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
335595 2020-12-13T08:56:31 Z Joshc 쌀 창고 (IOI11_ricehub) C++11
100 / 100
21 ms 1900 KB
#include "ricehub.h"
#include <algorithm>
using namespace std;
 
int besthub(int R, int L, int X[], long long B) {
  int left=0, right=0, best=0;
  long long total=0;
  while (left != R-1) {
    if (right >= R) break;
    int mid = (left+right)>>1;
    if (total+X[right]-X[mid] <= B) {
      total += X[right]-X[mid];
      best = max(best, right-left+1);
      right++;
    } else {
      total -= X[mid] - X[left];
      left = min(left+1, R-1);
      if (right==R-1) break;
    }
  }
  return best;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 0 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 364 KB Output is correct
2 Correct 0 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 0 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 0 ms 364 KB Output is correct
8 Correct 0 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 0 ms 364 KB Output is correct
12 Correct 0 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 364 KB Output is correct
15 Correct 0 ms 364 KB Output is correct
16 Correct 0 ms 364 KB Output is correct
17 Correct 0 ms 364 KB Output is correct
18 Correct 0 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 0 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 0 ms 364 KB Output is correct
23 Correct 0 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 0 ms 364 KB Output is correct
27 Correct 0 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 364 KB Output is correct
2 Correct 1 ms 364 KB Output is correct
3 Correct 1 ms 364 KB Output is correct
4 Correct 1 ms 364 KB Output is correct
5 Correct 1 ms 364 KB Output is correct
6 Correct 1 ms 364 KB Output is correct
7 Correct 1 ms 364 KB Output is correct
8 Correct 1 ms 364 KB Output is correct
9 Correct 1 ms 364 KB Output is correct
10 Correct 0 ms 364 KB Output is correct
11 Correct 1 ms 364 KB Output is correct
12 Correct 1 ms 364 KB Output is correct
13 Correct 1 ms 364 KB Output is correct
14 Correct 1 ms 416 KB Output is correct
15 Correct 1 ms 364 KB Output is correct
16 Correct 1 ms 364 KB Output is correct
17 Correct 1 ms 364 KB Output is correct
18 Correct 1 ms 364 KB Output is correct
19 Correct 1 ms 364 KB Output is correct
20 Correct 1 ms 364 KB Output is correct
21 Correct 1 ms 364 KB Output is correct
22 Correct 1 ms 364 KB Output is correct
23 Correct 1 ms 364 KB Output is correct
24 Correct 1 ms 364 KB Output is correct
25 Correct 1 ms 364 KB Output is correct
26 Correct 2 ms 364 KB Output is correct
27 Correct 1 ms 364 KB Output is correct
28 Correct 1 ms 364 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 492 KB Output is correct
2 Correct 3 ms 492 KB Output is correct
3 Correct 17 ms 1772 KB Output is correct
4 Correct 17 ms 1900 KB Output is correct
5 Correct 8 ms 876 KB Output is correct
6 Correct 7 ms 876 KB Output is correct
7 Correct 14 ms 1516 KB Output is correct
8 Correct 14 ms 1516 KB Output is correct
9 Correct 7 ms 748 KB Output is correct
10 Correct 7 ms 748 KB Output is correct
11 Correct 16 ms 1772 KB Output is correct
12 Correct 21 ms 1772 KB Output is correct
13 Correct 8 ms 876 KB Output is correct
14 Correct 8 ms 876 KB Output is correct
15 Correct 12 ms 1388 KB Output is correct
16 Correct 12 ms 1388 KB Output is correct
17 Correct 14 ms 1644 KB Output is correct
18 Correct 14 ms 1644 KB Output is correct
19 Correct 15 ms 1644 KB Output is correct
20 Correct 15 ms 1644 KB Output is correct