답안 #1003338

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1003338 2024-06-20T09:03:28 Z vjudge1 쌀 창고 (IOI11_ricehub) C++17
100 / 100
12 ms 2680 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 5;
ll a[N];
int b;


int besthub(int n, int L, int X[], ll B){  
    ll ans = 0;
    ll pref[N + 1];
    pref[0] = 0;
    for(int i = 0; i < n; ++i)
        pref[i + 1] = pref[i] + X[i];
    
    if(B >= pref[n])
        return n;
    ll l = 1, r = 1;
    while(r <= n)
    {
        ll mid = (l + r) >> 1;
        if(ans == n)
            return n;
        if( ((X[mid - 1] * (mid - l)) - (pref[mid - 1] - pref[l - 1]) + ((pref[r] - pref[mid]) - (X[mid - 1] * (r - mid)))) <= B)
            ans = max(ans,r-l+1);
        
        else
            ++l;
       ++r;
    }
    return ans;
    

}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1116 KB Output is correct
2 Correct 1 ms 1116 KB Output is correct
3 Correct 1 ms 1116 KB Output is correct
4 Correct 1 ms 1116 KB Output is correct
5 Correct 1 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1112 KB Output is correct
2 Correct 1 ms 1116 KB Output is correct
3 Correct 0 ms 1116 KB Output is correct
4 Correct 1 ms 1116 KB Output is correct
5 Correct 1 ms 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1372 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1116 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1196 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 1 ms 1112 KB Output is correct
14 Correct 1 ms 1116 KB Output is correct
15 Correct 1 ms 1216 KB Output is correct
16 Correct 1 ms 1116 KB Output is correct
17 Correct 1 ms 1116 KB Output is correct
18 Correct 0 ms 1116 KB Output is correct
19 Correct 1 ms 1116 KB Output is correct
20 Correct 0 ms 1116 KB Output is correct
21 Correct 1 ms 1116 KB Output is correct
22 Correct 1 ms 1112 KB Output is correct
23 Correct 1 ms 1116 KB Output is correct
24 Correct 1 ms 1212 KB Output is correct
25 Correct 1 ms 1116 KB Output is correct
26 Correct 1 ms 1116 KB Output is correct
27 Correct 1 ms 1116 KB Output is correct
28 Correct 1 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1116 KB Output is correct
2 Correct 1 ms 1116 KB Output is correct
3 Correct 1 ms 1116 KB Output is correct
4 Correct 1 ms 1116 KB Output is correct
5 Correct 1 ms 1116 KB Output is correct
6 Correct 1 ms 1116 KB Output is correct
7 Correct 1 ms 1116 KB Output is correct
8 Correct 1 ms 1116 KB Output is correct
9 Correct 1 ms 1204 KB Output is correct
10 Correct 1 ms 1116 KB Output is correct
11 Correct 1 ms 1116 KB Output is correct
12 Correct 1 ms 1116 KB Output is correct
13 Correct 1 ms 1116 KB Output is correct
14 Correct 1 ms 1116 KB Output is correct
15 Correct 1 ms 1112 KB Output is correct
16 Correct 1 ms 1372 KB Output is correct
17 Correct 1 ms 1116 KB Output is correct
18 Correct 1 ms 1116 KB Output is correct
19 Correct 1 ms 1112 KB Output is correct
20 Correct 1 ms 1112 KB Output is correct
21 Correct 1 ms 1116 KB Output is correct
22 Correct 1 ms 1116 KB Output is correct
23 Correct 1 ms 1116 KB Output is correct
24 Correct 1 ms 1116 KB Output is correct
25 Correct 1 ms 1116 KB Output is correct
26 Correct 1 ms 1116 KB Output is correct
27 Correct 2 ms 1220 KB Output is correct
28 Correct 1 ms 1116 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1372 KB Output is correct
2 Correct 2 ms 1372 KB Output is correct
3 Correct 12 ms 2680 KB Output is correct
4 Correct 9 ms 2680 KB Output is correct
5 Correct 5 ms 1732 KB Output is correct
6 Correct 5 ms 1624 KB Output is correct
7 Correct 9 ms 2292 KB Output is correct
8 Correct 7 ms 2140 KB Output is correct
9 Correct 4 ms 1628 KB Output is correct
10 Correct 3 ms 1516 KB Output is correct
11 Correct 9 ms 2652 KB Output is correct
12 Correct 9 ms 2616 KB Output is correct
13 Correct 4 ms 1628 KB Output is correct
14 Correct 4 ms 1628 KB Output is correct
15 Correct 10 ms 2176 KB Output is correct
16 Correct 7 ms 2136 KB Output is correct
17 Correct 8 ms 2396 KB Output is correct
18 Correct 8 ms 2348 KB Output is correct
19 Correct 8 ms 2396 KB Output is correct
20 Correct 9 ms 2520 KB Output is correct