답안 #125578

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
125578 2019-07-06T02:04:18 Z ksmzzang2003 쌀 창고 (IOI11_ricehub) C++14
100 / 100
21 ms 3320 KB
#include "ricehub.h"
#include <bits/stdc++.h>
#define MAXN 100005
typedef long long ll;
using namespace std;

static int N; ll X[MAXN],S[MAXN];

ll f(int s,int e)
{
    int t = (s+e)/2;
    return S[e] - S[t] - X[t]*(e-t) +(t-s) *X[t] - (S[t-1]-S[s-1]);
}

int besthub(int n, int L, int x[], ll B)
{
   N = n ;
   for(int i=0;i<N;i++) X[i+1] = x[i];
   for(int i=1;i<=N;i++) S[i] = S[i-1] + X[i];
   int s=1, e = 1,ans=-1987654321;
   while(1)
   {
       if(s+1<=e && f(s,e)>B) s++;
       ans = max(ans,e-s+1);
       e++;
       if(e>N) break;
   }
   return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 504 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 504 KB Output is correct
4 Correct 3 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 380 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 2 ms 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 2 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 376 KB Output is correct
24 Correct 2 ms 360 KB Output is correct
25 Correct 2 ms 376 KB Output is correct
26 Correct 2 ms 364 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 380 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 380 KB Output is correct
7 Correct 2 ms 400 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 376 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 376 KB Output is correct
12 Correct 2 ms 376 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 376 KB Output is correct
16 Correct 3 ms 348 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 376 KB Output is correct
19 Correct 3 ms 376 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 3 ms 504 KB Output is correct
23 Correct 3 ms 504 KB Output is correct
24 Correct 3 ms 504 KB Output is correct
25 Correct 3 ms 504 KB Output is correct
26 Correct 3 ms 504 KB Output is correct
27 Correct 3 ms 504 KB Output is correct
28 Correct 3 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 888 KB Output is correct
2 Correct 5 ms 888 KB Output is correct
3 Correct 19 ms 3292 KB Output is correct
4 Correct 19 ms 3320 KB Output is correct
5 Correct 9 ms 1656 KB Output is correct
6 Correct 9 ms 1656 KB Output is correct
7 Correct 17 ms 3064 KB Output is correct
8 Correct 17 ms 3092 KB Output is correct
9 Correct 9 ms 1528 KB Output is correct
10 Correct 9 ms 1656 KB Output is correct
11 Correct 21 ms 3320 KB Output is correct
12 Correct 21 ms 3320 KB Output is correct
13 Correct 10 ms 1656 KB Output is correct
14 Correct 10 ms 1656 KB Output is correct
15 Correct 16 ms 2532 KB Output is correct
16 Correct 16 ms 2496 KB Output is correct
17 Correct 19 ms 3064 KB Output is correct
18 Correct 19 ms 2936 KB Output is correct
19 Correct 20 ms 3224 KB Output is correct
20 Correct 20 ms 3192 KB Output is correct