답안 #1003321

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1003321 2024-06-20T08:56:13 Z vjudge1 쌀 창고 (IOI11_ricehub) C++17
42 / 100
1000 ms 1192 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define ll long long
#define pll pair<ll, ll>
/*ll p[5005];

pll binary1(ll b, ll e, ll num, ll money)
{
    ll l = b, r = e, ans = 0;
    while (l <= r){
        ll m = (l + r)/2;
        if (p[m] - p[b-1] - ((m-b+1)*num) <= money){
            l = m + 1;
            ans = money - (p[m] - p[b-1] - ((m-b+1)*num));
        }
        else {
            r = m - 1;
        }
    }
    return {ans, l-1};
}

pll binary2(ll b, ll e, ll num, ll money)
{
    ll l = b, r = e, ans = 0;
    while (l <= r){
        ll m = (l + r)/2;
        if ((e-m+1)*num - (p[e] - p[m-1]) <= money){
            r = m - 1;
            ans = money - (e-m+1)*num - (p[e] - p[m-1]);
        }
        else {
            l = m + 1;
        }
    }
    return {ans, r+1};
}*/

int besthub(int n, int l, int a[], long long b)
{
    /*for (ll i = 0; i<n; i++){
        p[i+1] = p[i] + a[i];
    }*/
    ll mx = 0;
    for (ll i = 0; i<n; i++){
        priority_queue<ll, vector<ll>, greater<ll>>pq;
        for (ll j = 0; j<i; j++){
            pq.push(a[i] - a[j]);
        }
        for (ll j = i; j<n; j++){
            pq.push(a[j] - a[i]);
        }
        ll sum = 0, cnt = 0;
        while (pq.size()){
            ll x = pq.top();
            pq.pop();
            sum += x;
            cnt++;
            if (sum > b){
                sum -= x;
                cnt--;
                break;
            }
        }
        mx = max(mx, cnt);
    }
    return mx;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 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 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 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 348 KB Output is correct
6 Correct 1 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 1 ms 456 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 344 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 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 2 ms 348 KB Output is correct
22 Correct 2 ms 348 KB Output is correct
23 Correct 8 ms 460 KB Output is correct
24 Correct 10 ms 348 KB Output is correct
25 Correct 8 ms 348 KB Output is correct
26 Correct 8 ms 348 KB Output is correct
27 Correct 6 ms 348 KB Output is correct
28 Correct 6 ms 460 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 33 ms 448 KB Output is correct
4 Correct 31 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 6 ms 348 KB Output is correct
8 Correct 7 ms 348 KB Output is correct
9 Correct 3 ms 348 KB Output is correct
10 Correct 3 ms 348 KB Output is correct
11 Correct 7 ms 476 KB Output is correct
12 Correct 7 ms 448 KB Output is correct
13 Correct 48 ms 348 KB Output is correct
14 Correct 39 ms 348 KB Output is correct
15 Correct 5 ms 348 KB Output is correct
16 Correct 5 ms 348 KB Output is correct
17 Correct 26 ms 344 KB Output is correct
18 Correct 24 ms 348 KB Output is correct
19 Correct 39 ms 348 KB Output is correct
20 Correct 37 ms 448 KB Output is correct
21 Correct 210 ms 348 KB Output is correct
22 Correct 233 ms 348 KB Output is correct
23 Execution timed out 1084 ms 348 KB Time limit exceeded
24 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1053 ms 1192 KB Time limit exceeded
2 Halted 0 ms 0 KB -