답안 #563325

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
563325 2022-05-16T22:06:57 Z 1ne 쌀 창고 (IOI11_ricehub) C++14
0 / 100
21 ms 3340 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
  int ans = 1;
  vector<int64_t>pref(R + 1,0),dpref(R + 1,0);
  for (int i = 0 ;i<R - 1;++i){
	  pref[i + 1] = pref[i] + (X[i + 1] - X[i]);
	  dpref[i + 2] = pref[i + 1] + dpref[i + 1];
  }
  auto dist = [&](int l,int r){
	 return pref[r] * (r - l) - dpref[r] + dpref[l];
  };
  auto distt = [&](int l,int r){
	  int mid = (l + r)>>1;
		return dist(l,mid) + dist(mid , r);
  };
  for (int r = 0, l = 0; r < R; r++) {
        while (true) {
            //int mid = (l + r) >> 1;
            if (distt(l,r) <= B)
                break;
            l++; 
        }
 
        ans = max(ans, r - l + 1);
    }
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 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 1 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 Incorrect 0 ms 212 KB Output isn't correct
12 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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
6 Correct 0 ms 212 KB Output is correct
7 Incorrect 0 ms 212 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 596 KB Output is correct
2 Correct 2 ms 596 KB Output is correct
3 Correct 12 ms 2168 KB Output is correct
4 Correct 21 ms 3340 KB Output is correct
5 Incorrect 7 ms 1620 KB Output isn't correct
6 Halted 0 ms 0 KB -