Submission #963302

# Submission time Handle Problem Language Result Execution time Memory
963302 2024-04-14T20:33:59 Z SuPythony Rice Hub (IOI11_ricehub) C++17
42 / 100
1000 ms 2128 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int besthub(int R, int L, int X[], long long B)
{
    int ans=0;
    for (int i=1; i<=L; i++) {
        vector<ll> c;
        for (int j=0; j<R; j++) {
            c.push_back(abs(i-X[j]));
        }
        sort(c.begin(),c.end());
        ll used=0;
        int a=0;
        for (ll i: c) {
            if (used+i<=B) {
                used+=i;
                a++;
            } else break;
        }        
        ans=max(ans,a);
    }
    return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 1 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 1 ms 348 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 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 1 ms 348 KB Output is correct
11 Correct 1 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 2 ms 348 KB Output is correct
16 Correct 1 ms 448 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 2 ms 348 KB Output is correct
20 Correct 2 ms 348 KB Output is correct
21 Correct 5 ms 348 KB Output is correct
22 Correct 5 ms 600 KB Output is correct
23 Correct 81 ms 436 KB Output is correct
24 Correct 83 ms 600 KB Output is correct
25 Correct 85 ms 432 KB Output is correct
26 Correct 72 ms 600 KB Output is correct
27 Correct 66 ms 344 KB Output is correct
28 Correct 73 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 17 ms 348 KB Output is correct
2 Correct 17 ms 348 KB Output is correct
3 Execution timed out 1051 ms 348 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1033 ms 2128 KB Time limit exceeded
2 Halted 0 ms 0 KB -