답안 #614009

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
614009 2022-07-30T16:28:16 Z chirathnirodha 쌀 창고 (IOI11_ricehub) C++17
100 / 100
12 ms 1804 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
#define PB push_back 
typedef long long ll;

int besthub(int R, int L, int X[], long long B){
  int a=0;int b=0;
  int ans=1;
  ll curcos=0;
  while(a<R && b<R){
    int pm=(a+b)/2;
    if(curcos<=B){
      ans=max(ans,b-a+1);
      if(b==R-1)break;
      b++;
      curcos+=X[b]-X[pm];
    }
    else{
      curcos-=X[pm]-X[a];
      a++;
    }
    int nm=(a+b)/2;
    curcos+=(X[nm]-X[pm])*((nm-a)-(b-pm));
  }
  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 312 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 0 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 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 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 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 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 1 ms 316 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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
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 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 316 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 316 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 324 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 340 KB Output is correct
23 Correct 1 ms 320 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 324 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 324 KB Output is correct
28 Correct 1 ms 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 12 ms 656 KB Output is correct
4 Correct 10 ms 684 KB Output is correct
5 Correct 5 ms 468 KB Output is correct
6 Correct 5 ms 852 KB Output is correct
7 Correct 10 ms 1476 KB Output is correct
8 Correct 10 ms 1364 KB Output is correct
9 Correct 5 ms 724 KB Output is correct
10 Correct 5 ms 724 KB Output is correct
11 Correct 11 ms 1708 KB Output is correct
12 Correct 11 ms 1804 KB Output is correct
13 Correct 5 ms 852 KB Output is correct
14 Correct 5 ms 840 KB Output is correct
15 Correct 8 ms 1316 KB Output is correct
16 Correct 8 ms 1356 KB Output is correct
17 Correct 10 ms 1468 KB Output is correct
18 Correct 11 ms 1552 KB Output is correct
19 Correct 10 ms 1584 KB Output is correct
20 Correct 10 ms 1588 KB Output is correct