답안 #898744

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
898744 2024-01-05T05:20:47 Z Sir_Ahmed_Imran 쌀 창고 (IOI11_ricehub) C++17
25 / 100
11 ms 3632 KB
                              ///~~~LOTA~~~///
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long 
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define MAXN 100000
ll a[MAXN];
ll b[MAXN];
bool check(ll n,ll l,ll r,int v[],ll& x){
    if(l==r) return 1;
    int mid=(l+r)/2;
    ll o=a[mid]+b[mid];
    o-=a[l]+(v[mid]-v[l])*l;
    o-=b[r]+(v[r]-v[mid])*(n-r-1);
    if(o>x) return 0;
    return 1;
}
int besthub(int n,int m,int v[],ll x){
    ll o,p,q;
    a[0]=b[n-1]=o=p=q=0;
    for(int i=1;i<n;i++)
        a[i]=a[i-1]+i*(v[i]-v[i-1]);
    for(int i=n-2;i>=0;i--)
        b[i]=b[i+1]+(n-1-i)*(v[i+1]-v[i]);
    while(q<=n){
        if(check(n,p,q,v,x)){
            o=max(o,q-p);
            q++;
        }
        else p++;
    }
    return o;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Incorrect 1 ms 2396 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 1 ms 2392 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 0 ms 2396 KB Output is correct
12 Correct 0 ms 2396 KB Output is correct
13 Correct 0 ms 2396 KB Output is correct
14 Correct 0 ms 2396 KB Output is correct
15 Correct 1 ms 2396 KB Output is correct
16 Correct 1 ms 2396 KB Output is correct
17 Correct 0 ms 2396 KB Output is correct
18 Correct 1 ms 2392 KB Output is correct
19 Correct 1 ms 2396 KB Output is correct
20 Correct 0 ms 2396 KB Output is correct
21 Correct 1 ms 2396 KB Output is correct
22 Correct 1 ms 2396 KB Output is correct
23 Correct 0 ms 2396 KB Output is correct
24 Correct 1 ms 2396 KB Output is correct
25 Correct 0 ms 2396 KB Output is correct
26 Correct 1 ms 2396 KB Output is correct
27 Correct 1 ms 2396 KB Output is correct
28 Correct 1 ms 2392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 1 ms 2396 KB Output is correct
6 Correct 0 ms 2396 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
8 Correct 0 ms 2396 KB Output is correct
9 Correct 0 ms 2396 KB Output is correct
10 Correct 0 ms 2396 KB Output is correct
11 Correct 1 ms 2396 KB Output is correct
12 Correct 1 ms 2396 KB Output is correct
13 Correct 1 ms 2396 KB Output is correct
14 Correct 1 ms 2396 KB Output is correct
15 Incorrect 0 ms 2396 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2652 KB Output is correct
2 Correct 2 ms 2652 KB Output is correct
3 Correct 10 ms 2496 KB Output is correct
4 Correct 10 ms 3500 KB Output is correct
5 Correct 5 ms 2904 KB Output is correct
6 Correct 5 ms 2908 KB Output is correct
7 Correct 9 ms 3420 KB Output is correct
8 Correct 11 ms 3376 KB Output is correct
9 Correct 5 ms 2908 KB Output is correct
10 Correct 4 ms 2780 KB Output is correct
11 Correct 10 ms 3632 KB Output is correct
12 Incorrect 10 ms 3500 KB Output isn't correct
13 Halted 0 ms 0 KB -