Submission #1003111

# Submission time Handle Problem Language Result Execution time Memory
1003111 2024-06-20T06:20:45 Z vjudge1 Rice Hub (IOI11_ricehub) C++17
68 / 100
1000 ms 2136 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define ll long long
const int N = 1e5 + 5;
int a[N];
int b;


int besthub(int n, int L, int X[], ll B){  
    int ans = 0, cur = 0, cnt = 0;
    for(int i = 0; i < n; ++i)
        a[i] = X[i];
    for(int i = 0; i < n; ++i)
    {
        int l = i, r = i + 1;
        cur = 0,cnt = 0;
        while(l >= 0 || r < n){
            if((l >= 0 && a[i] - a[l] < a[r] - a[i]) || (r >= n)){
                cur += a[i] - a[l];
                --l;
            }   
            else
            {
                cur += a[r] - a[i];
                ++r;
            }
            if(cur > B)
            {
                break;
            }
            cnt++;
        }
        ans = max(ans,cnt);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 600 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 388 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 444 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 604 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 344 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 440 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 2 ms 452 KB Output is correct
18 Correct 2 ms 348 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 3 ms 468 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 2 ms 508 KB Output is correct
23 Correct 30 ms 348 KB Output is correct
24 Correct 26 ms 344 KB Output is correct
25 Correct 72 ms 348 KB Output is correct
26 Correct 70 ms 344 KB Output is correct
27 Correct 17 ms 348 KB Output is correct
28 Correct 20 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 600 KB Output is correct
2 Correct 3 ms 636 KB Output is correct
3 Execution timed out 1027 ms 2136 KB Time limit exceeded
4 Halted 0 ms 0 KB -