답안 #500825

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
500825 2022-01-01T10:37:24 Z beaconmc 쌀 창고 (IOI11_ricehub) C++14
100 / 100
13 ms 672 KB
//#include "ricehub.h"



typedef long long ll;
#define FOR(i, x, y) for(ll i=x; i<y; i++)

using namespace std;
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
  
#define ordered_set tree<ll, null_type,less_equal<ll>, rb_tree_tag,tree_order_statistics_node_update>


int besthub(int R,int L,int X[],ll B){
    ll lo=0,hi=0,ans=1,curcost=0;
    while (hi<R){
        if ((hi-lo)%2==0 && hi!=lo) curcost += X[hi] - X[(hi-lo-1)/2+1 + lo];
        else curcost += X[hi] - X[(hi-lo-1)/2 + lo];
        if (curcost>B){
            if ((hi-lo)%2==0) curcost += X[lo] -X[hi];
            else curcost += X[lo] - X[hi];
            lo ++;
        } else hi++;
        ans = max(ans, hi-lo);
    }
    return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 0 ms 204 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 0 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 0 ms 204 KB Output is correct
22 Correct 0 ms 204 KB Output is correct
23 Correct 0 ms 204 KB Output is correct
24 Correct 0 ms 204 KB Output is correct
25 Correct 0 ms 204 KB Output is correct
26 Correct 1 ms 276 KB Output is correct
27 Correct 0 ms 204 KB Output is correct
28 Correct 0 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 0 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 0 ms 204 KB Output is correct
15 Correct 0 ms 204 KB Output is correct
16 Correct 0 ms 204 KB Output is correct
17 Correct 0 ms 204 KB Output is correct
18 Correct 0 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 0 ms 204 KB Output is correct
21 Correct 1 ms 204 KB Output is correct
22 Correct 1 ms 204 KB Output is correct
23 Correct 1 ms 204 KB Output is correct
24 Correct 1 ms 204 KB Output is correct
25 Correct 1 ms 204 KB Output is correct
26 Correct 1 ms 204 KB Output is correct
27 Correct 2 ms 204 KB Output is correct
28 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Correct 13 ms 576 KB Output is correct
4 Correct 13 ms 640 KB Output is correct
5 Correct 6 ms 460 KB Output is correct
6 Correct 6 ms 452 KB Output is correct
7 Correct 11 ms 588 KB Output is correct
8 Correct 12 ms 564 KB Output is correct
9 Correct 6 ms 460 KB Output is correct
10 Correct 5 ms 352 KB Output is correct
11 Correct 13 ms 672 KB Output is correct
12 Correct 13 ms 588 KB Output is correct
13 Correct 6 ms 460 KB Output is correct
14 Correct 8 ms 440 KB Output is correct
15 Correct 9 ms 460 KB Output is correct
16 Correct 10 ms 460 KB Output is correct
17 Correct 11 ms 636 KB Output is correct
18 Correct 13 ms 604 KB Output is correct
19 Correct 13 ms 648 KB Output is correct
20 Correct 13 ms 604 KB Output is correct