Submission #500812

# Submission time Handle Problem Language Result Execution time Memory
500812 2022-01-01T10:21:25 Z beaconmc Rice Hub (IOI11_ricehub) C++14
17 / 100
11 ms 1732 KB
//#include "ricehub.h"
#include <bits/stdc++.h>


typedef long long ll;
#define FOR(i, x, y) for(ll i=x; i<y; i++)

using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
  
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>


int besthub(int R, int L, int X[], ll B){
    ll lo = 0, hi = 0;
    ll ans = 1;
    ll curcost  = 0;
    while (hi<R-1){
        if (hi==lo) curcost += 0;
        else if ((hi-lo)%2==0) curcost += X[hi] - X[(hi-lo-1)/2+1 + lo];
        else curcost += X[hi] - X[(hi-lo-1)/2 + lo];
        if (curcost>B){
            if ((hi-lo)%2==0) curcost -= X[hi], curcost += X[lo];
            else curcost -= X[hi], curcost+= X[lo];
            lo ++;
        } else hi++;
        
        
        ans = max(ans, hi-lo);
    }
    return ans;
}



# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 304 KB Output is correct
5 Correct 0 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 0 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 3 ms 440 KB Output is correct
3 Incorrect 11 ms 1732 KB Output isn't correct
4 Halted 0 ms 0 KB -