Submission #417818

# Submission time Handle Problem Language Result Execution time Memory
417818 2021-06-04T10:57:41 Z ioi Rice Hub (IOI11_ricehub) C++14
0 / 100
1000 ms 262148 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std ;

int besthub(int R, int L, int X[], long long B)
{


    int mx = 0 ;

    int e[L + 10] = {};

    for(int i = 0 ; i < R ; i ++)
        e[X[i]] ++ ;

    for(int i = 1 ; i <= L ; i ++){
        int sum = B ;
        int ans = 0 ;
        int pl = i  , pr = i;
        int d = 0 ;
        while(sum > 0 && (pl >=0 || pr < R + 9) ){
            d ++ ;

            pl -- , pr ++ ;
            if(pl >= 0 && e[pl]){
                if(sum > d)ans ++ , sum -= d ;
                else break;
            }
            if(pr < L + 9 && e[pr]){
                if(sum > d)ans ++ , sum -= d ;
                else break;
            }
        }

        mx = max(mx , ans);

    }
    return mx ;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 19 ms 332 KB Output is correct
2 Correct 21 ms 204 KB Output is correct
3 Execution timed out 1077 ms 3916 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 68 ms 716 KB Output is correct
2 Correct 59 ms 740 KB Output is correct
3 Runtime error 139 ms 262148 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -