답안 #164831

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
164831 2019-11-23T16:27:14 Z arnold518 쌀 창고 (IOI11_ricehub) C++14
100 / 100
19 ms 760 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;

int R, L, *X, ans;
ll B;

int besthub(int _R, int _L, int *_X, ll _B)
{
    int i, j;
    R=_R; L=_L; X=_X; B=_B;

    ll S=0;
    for(i=0, j=0; i<R; i++)
    {
        while(S<=B && j<R) { j++; S+=X[j]-X[i+j>>1]; }
        S-=X[i+j+1>>1]-X[i];
        ans=max(ans, j-i);
    }
    return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:20:46: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         while(S<=B && j<R) { j++; S+=X[j]-X[i+j>>1]; }
                                             ~^~
ricehub.cpp:21:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         S-=X[i+j+1>>1]-X[i];
              ~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 376 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 376 KB Output is correct
5 Correct 2 ms 256 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 256 KB Output is correct
4 Correct 2 ms 252 KB Output is correct
5 Correct 3 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 256 KB Output is correct
8 Correct 2 ms 376 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 256 KB Output is correct
14 Correct 2 ms 376 KB Output is correct
15 Correct 2 ms 368 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 256 KB Output is correct
18 Correct 2 ms 296 KB Output is correct
19 Correct 2 ms 376 KB Output is correct
20 Correct 2 ms 256 KB Output is correct
21 Correct 2 ms 256 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 2 ms 256 KB Output is correct
24 Correct 2 ms 504 KB Output is correct
25 Correct 4 ms 376 KB Output is correct
26 Correct 2 ms 256 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 376 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 376 KB Output is correct
6 Correct 2 ms 256 KB Output is correct
7 Correct 2 ms 376 KB Output is correct
8 Correct 2 ms 256 KB Output is correct
9 Correct 2 ms 256 KB Output is correct
10 Correct 2 ms 376 KB Output is correct
11 Correct 2 ms 256 KB Output is correct
12 Correct 2 ms 256 KB Output is correct
13 Correct 2 ms 376 KB Output is correct
14 Correct 2 ms 256 KB Output is correct
15 Correct 2 ms 256 KB Output is correct
16 Correct 2 ms 256 KB Output is correct
17 Correct 2 ms 252 KB Output is correct
18 Correct 2 ms 380 KB Output is correct
19 Correct 2 ms 256 KB Output is correct
20 Correct 2 ms 376 KB Output is correct
21 Correct 3 ms 376 KB Output is correct
22 Correct 2 ms 376 KB Output is correct
23 Correct 3 ms 376 KB Output is correct
24 Correct 3 ms 376 KB Output is correct
25 Correct 3 ms 380 KB Output is correct
26 Correct 3 ms 376 KB Output is correct
27 Correct 3 ms 376 KB Output is correct
28 Correct 3 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 18 ms 676 KB Output is correct
4 Correct 18 ms 760 KB Output is correct
5 Correct 8 ms 632 KB Output is correct
6 Correct 8 ms 504 KB Output is correct
7 Correct 15 ms 760 KB Output is correct
8 Correct 15 ms 688 KB Output is correct
9 Correct 8 ms 504 KB Output is correct
10 Correct 8 ms 504 KB Output is correct
11 Correct 19 ms 672 KB Output is correct
12 Correct 19 ms 760 KB Output is correct
13 Correct 11 ms 504 KB Output is correct
14 Correct 9 ms 504 KB Output is correct
15 Correct 15 ms 632 KB Output is correct
16 Correct 15 ms 636 KB Output is correct
17 Correct 17 ms 632 KB Output is correct
18 Correct 18 ms 632 KB Output is correct
19 Correct 18 ms 632 KB Output is correct
20 Correct 18 ms 760 KB Output is correct