Submission #164830

# Submission time Handle Problem Language Result Execution time Memory
164830 2019-11-23T16:25:23 Z arnold518 Rice Hub (IOI11_ricehub) C++14
100 / 100
24 ms 1824 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:23:24: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
             S+=X[j]-X[i+j>>1];
                       ~^~
ricehub.cpp:25:17: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
         S-=X[i+j+1>>1]-X[i];
              ~~~^~
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
5 Correct 2 ms 312 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 376 KB Output is correct
2 Correct 2 ms 368 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 376 KB Output is correct
6 Correct 2 ms 376 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 376 KB Output is correct
10 Correct 2 ms 256 KB Output is correct
11 Correct 3 ms 376 KB Output is correct
12 Correct 0 ms 376 KB Output is correct
13 Correct 2 ms 256 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 376 KB Output is correct
17 Correct 2 ms 376 KB Output is correct
18 Correct 2 ms 256 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 256 KB Output is correct
25 Correct 2 ms 256 KB Output is correct
26 Correct 2 ms 376 KB Output is correct
27 Correct 2 ms 376 KB Output is correct
28 Correct 2 ms 252 KB Output is correct
# Verdict Execution time Memory 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 256 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 256 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 380 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 3 ms 376 KB Output is correct
22 Correct 3 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 376 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
# Verdict Execution time Memory Grader output
1 Correct 5 ms 380 KB Output is correct
2 Correct 5 ms 504 KB Output is correct
3 Correct 18 ms 1784 KB Output is correct
4 Correct 18 ms 1824 KB Output is correct
5 Correct 8 ms 888 KB Output is correct
6 Correct 8 ms 888 KB Output is correct
7 Correct 15 ms 1528 KB Output is correct
8 Correct 15 ms 1528 KB Output is correct
9 Correct 8 ms 888 KB Output is correct
10 Correct 8 ms 888 KB Output is correct
11 Correct 20 ms 1784 KB Output is correct
12 Correct 19 ms 1784 KB Output is correct
13 Correct 9 ms 888 KB Output is correct
14 Correct 9 ms 888 KB Output is correct
15 Correct 15 ms 1400 KB Output is correct
16 Correct 15 ms 1400 KB Output is correct
17 Correct 24 ms 1656 KB Output is correct
18 Correct 20 ms 1660 KB Output is correct
19 Correct 19 ms 1656 KB Output is correct
20 Correct 19 ms 1656 KB Output is correct