Submission #1015162

# Submission time Handle Problem Language Result Execution time Memory
1015162 2024-07-06T06:53:04 Z KasymK Rice Hub (IOI11_ricehub) C++17
17 / 100
1000 ms 856 KB
#include "bits/stdc++.h"
using namespace std;
#define ll long long
#define ff first
#define ss second
#define all(v) v.begin(), v.end()

int besthub(int r, int l, int x[], ll b){
    ll b_ = b;
    int answer = 0;
    deque<int> diff;
    for(int cor = 1; cor <= l; ++cor){
        diff.clear();
        int sm = 0;
        for(int i = 0; i < r; ++i)
            diff.push_back(abs(cor-x[i]));
        sort(all(diff));
        while(1){
            if(b-diff[0] >= 0)
                b -= diff[0], diff.pop_front(), sm++;
            else
                break;
        }
        answer = max(answer, sm);
        b = b_;
    }
    return answer;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 856 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 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 348 KB Output is correct
3 Runtime error 1 ms 348 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 24 ms 344 KB Output is correct
2 Correct 22 ms 344 KB Output is correct
3 Runtime error 1 ms 348 KB Execution killed with signal 11
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 604 KB Time limit exceeded
2 Halted 0 ms 0 KB -