답안 #639755

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
639755 2022-09-11T13:58:29 Z bonk 쌀 창고 (IOI11_ricehub) C++14
68 / 100
1000 ms 3620 KB
#include <bits/stdc++.h>
#include <ricehub.h>

using namespace std;
using ll = long long;

int besthub(int r, int l, int x[], ll b){
    ll ans = 0;

    for(int i = 0; i < r; i++){
        priority_queue<ll>pq;
        ll cost = 0;
        ll tmp = 0;
        for(int j = 0; j < r; j++){
            ll a = abs(x[j] - x[i]);
            if(cost + a <= b){
                pq.push(a);
                cost += a;
                tmp++;
            } else if(!pq.empty() && pq.top() > a){
                cost -= pq.top(); pq.pop();
                cost += a;
                pq.push(a);
            }
        }

        ans = max(ans, tmp);
    }

    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 2 ms 212 KB Output is correct
23 Correct 4 ms 212 KB Output is correct
24 Correct 4 ms 212 KB Output is correct
25 Correct 4 ms 212 KB Output is correct
26 Correct 4 ms 212 KB Output is correct
27 Correct 5 ms 288 KB Output is correct
28 Correct 5 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 9 ms 212 KB Output is correct
4 Correct 11 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 5 ms 212 KB Output is correct
8 Correct 5 ms 320 KB Output is correct
9 Correct 4 ms 308 KB Output is correct
10 Correct 4 ms 212 KB Output is correct
11 Correct 9 ms 316 KB Output is correct
12 Correct 9 ms 312 KB Output is correct
13 Correct 11 ms 332 KB Output is correct
14 Correct 14 ms 328 KB Output is correct
15 Correct 5 ms 212 KB Output is correct
16 Correct 5 ms 308 KB Output is correct
17 Correct 7 ms 212 KB Output is correct
18 Correct 9 ms 212 KB Output is correct
19 Correct 12 ms 212 KB Output is correct
20 Correct 14 ms 212 KB Output is correct
21 Correct 136 ms 308 KB Output is correct
22 Correct 134 ms 340 KB Output is correct
23 Correct 296 ms 340 KB Output is correct
24 Correct 343 ms 444 KB Output is correct
25 Correct 311 ms 444 KB Output is correct
26 Correct 315 ms 456 KB Output is correct
27 Correct 498 ms 412 KB Output is correct
28 Correct 511 ms 464 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 816 ms 368 KB Output is correct
2 Correct 781 ms 588 KB Output is correct
3 Execution timed out 1079 ms 3620 KB Time limit exceeded
4 Halted 0 ms 0 KB -