답안 #533619

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
533619 2022-03-06T16:28:55 Z __Variatto 쌀 창고 (IOI11_ricehub) C++17
68 / 100
13 ms 2468 KB
#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;
#define pb push_back
#define fi first
#define se second
#define ll long long
const int MAX=1e5+10;
int n, l, b, pref[MAX], t[MAX];
bool spr(int x){
    for(int i=1; i<=n-x+1; i++){
        int mid=(i+i+x-1)/2;
        int lewo=pref[mid-1]-pref[i-1];
        int prawo=pref[i+x-1]-pref[mid];
        if((mid-i)*t[mid]-lewo+prawo-(i+x-1-mid)*t[mid]<=b)
            return true;
    }
    return false;
}
int  besthub(int R, int L, int X[], ll B){
    n=R, l=L, b=B;
    for(int i=1; i<=n; i++){
        pref[i]=X[i-1];
        t[i]=pref[i];
        pref[i]+=pref[i-1];
    }
    int pocz=1, kon=n, sr, wynik=1;
    while(pocz<=kon){
        sr=(pocz+kon)/2;
        if(spr(sr))
            pocz=sr+1, wynik=sr;
        else
            kon=sr-1;
    }
    return wynik;
}
/*int main(){
    ios_base::sync_with_stdio(false);
    cin.tie(0), cout.tie(0);
}*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 276 KB Output is correct
3 Correct 1 ms 300 KB Output is correct
4 Correct 0 ms 300 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 3 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 1 ms 304 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 304 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 300 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 0 ms 204 KB Output is correct
27 Correct 1 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 1 ms 300 KB Output is correct
8 Correct 1 ms 304 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 300 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 332 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 296 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 300 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 1 ms 332 KB Output is correct
22 Correct 2 ms 332 KB Output is correct
23 Correct 1 ms 332 KB Output is correct
24 Correct 1 ms 332 KB Output is correct
25 Correct 1 ms 332 KB Output is correct
26 Correct 1 ms 316 KB Output is correct
27 Correct 1 ms 332 KB Output is correct
28 Correct 1 ms 332 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 588 KB Output is correct
2 Correct 3 ms 568 KB Output is correct
3 Incorrect 13 ms 2468 KB Output isn't correct
4 Halted 0 ms 0 KB -