Submission #201233

# Submission time Handle Problem Language Result Execution time Memory
201233 2020-02-10T00:40:39 Z DavidDamian Rice Hub (IOI11_ricehub) C++11
100 / 100
24 ms 760 KB
#include "ricehub.h"
#include<bits/stdc++.h>
///Median
///Sliding window
///Determine the maximum number of reachable rice fields
using namespace std;
typedef long long ll;
#define debug(x) cout<<#x<<" = "<<x<<endl
int besthub(int N, int L, int X[], ll B)
{
    ll cost=0;
    int a=0,b=0;
    int maximum=0;
    while(b<N){
        int mid;
        if(cost<=B){
            maximum=max(maximum,b-a+1);
            b++;
            mid=(a+b)/2;
            if(b<N)
                cost+=X[b]-X[mid];
        }
        else{
            a++;
            mid=(a+b)/2;
            cost-=X[mid]-X[a-1];
        }
    }
    return maximum;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 4 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 256 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 4 ms 256 KB Output is correct
14 Correct 5 ms 256 KB Output is correct
15 Correct 5 ms 376 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 256 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 5 ms 256 KB Output is correct
21 Correct 5 ms 256 KB Output is correct
22 Correct 5 ms 256 KB Output is correct
23 Correct 5 ms 256 KB Output is correct
24 Correct 5 ms 256 KB Output is correct
25 Correct 5 ms 256 KB Output is correct
26 Correct 5 ms 256 KB Output is correct
27 Correct 5 ms 256 KB Output is correct
28 Correct 5 ms 256 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 4 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 256 KB Output is correct
12 Correct 5 ms 256 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Correct 5 ms 256 KB Output is correct
16 Correct 5 ms 256 KB Output is correct
17 Correct 5 ms 256 KB Output is correct
18 Correct 5 ms 376 KB Output is correct
19 Correct 5 ms 256 KB Output is correct
20 Correct 5 ms 376 KB Output is correct
21 Correct 5 ms 376 KB Output is correct
22 Correct 5 ms 376 KB Output is correct
23 Correct 5 ms 380 KB Output is correct
24 Correct 5 ms 376 KB Output is correct
25 Correct 6 ms 376 KB Output is correct
26 Correct 6 ms 376 KB Output is correct
27 Correct 6 ms 376 KB Output is correct
28 Correct 5 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Correct 22 ms 760 KB Output is correct
4 Correct 21 ms 760 KB Output is correct
5 Correct 12 ms 504 KB Output is correct
6 Correct 11 ms 504 KB Output is correct
7 Correct 19 ms 760 KB Output is correct
8 Correct 21 ms 760 KB Output is correct
9 Correct 12 ms 504 KB Output is correct
10 Correct 12 ms 504 KB Output is correct
11 Correct 23 ms 760 KB Output is correct
12 Correct 24 ms 760 KB Output is correct
13 Correct 13 ms 508 KB Output is correct
14 Correct 13 ms 504 KB Output is correct
15 Correct 18 ms 632 KB Output is correct
16 Correct 18 ms 636 KB Output is correct
17 Correct 21 ms 632 KB Output is correct
18 Correct 22 ms 632 KB Output is correct
19 Correct 22 ms 760 KB Output is correct
20 Correct 22 ms 760 KB Output is correct