답안 #1015325

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1015325 2024-07-06T08:44:34 Z KasymK 쌀 창고 (IOI11_ricehub) C++17
17 / 100
1000 ms 856 KB
#include "bits/stdc++.h"
using namespace std;
#define pb push_back
#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;
    vector<int> v;
    int ans = 0;
    for(int hub = 1; hub <= l; ++hub){
        int sm = 0;
        for(int i = 0; i < r; ++i)
            v.pb(abs(hub-x[i]));
        sort(all(v));
        reverse(all(v));
        while(1){
            if(b-v.back() >= 0)
                b -= v.back(), v.pop_back(), sm++;
            else
                break;
        }
        ans = max(ans, sm);
        v.clear();
        b = b_;
    }
    return ans;
}

// const int N = 20;
// int a[N];

// int main(){
//     int r, l;
//     ll b;
//     scanf("%d %d %lld", &r, &l, &b);
//     for(int i = 0; i < r; ++i)
//         scanf("%d", &a[i]);
//     printf("%d\n", besthub(r, l, a, b));
//     return 0;
// }
# 결과 실행 시간 메모리 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 0 ms 348 KB Output is correct
5 Correct 0 ms 448 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 360 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 13 ms 348 KB Output is correct
2 Correct 12 ms 448 KB Output is correct
3 Execution timed out 1041 ms 344 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1041 ms 856 KB Time limit exceeded
2 Halted 0 ms 0 KB -