Submission #417830

# Submission time Handle Problem Language Result Execution time Memory
417830 2021-06-04T11:16:40 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 ++){
        long long sum = B ;
        int ans = 0 ;
        int pl = i  , pr = i;
        int d = 0 ;
        while(sum > 0 && (pl >=0 || pr <= L ) ){
            d ++ ;

            pl -- , pr ++ ;
            if(pl > 0 && e[pl]){
                if(sum > d)ans ++ , sum -= d ;
                else break;
            }
            if(pr <= L && 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 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 13 ms 332 KB Output is correct
2 Correct 13 ms 332 KB Output is correct
3 Execution timed out 1093 ms 3916 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 39 ms 716 KB Output is correct
2 Correct 37 ms 760 KB Output is correct
3 Runtime error 141 ms 262148 KB Execution killed with signal 9
4 Halted 0 ms 0 KB -