답안 #43663

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
43663 2018-03-19T07:41:33 Z smu201111192 쌀 창고 (IOI11_ricehub) C++14
25 / 100
29 ms 10036 KB
#include "ricehub.h"
#include <iostream>
#include <cstdio>
#include <cassert>
#include <bitset>
#include <string>
#include <sstream>
#include <algorithm>
#include <set>
#include <numeric>
#include <cmath>
#include <map>
#include <vector>
#include <queue>
#include <stack>
#include <cstring>
#include <queue>
#include <numeric>
#include <iomanip>
#define ll long long
using namespace std;
const int MAXN = 400005;
long long sum[MAXN];
long long loc[MAXN];
int n;
int can(int mid,long long lim){
    //mid개를 제거하면 가능한지
    for(int L = 0; L <= mid; L++){
        int R = mid - L;
        int lpos = L + 1;
        int rpos = n - R;
        int mpos = (lpos+rpos)/2;
        long long tot = 0;
        long long lcnt = mpos - lpos + 1;
        long long rcnt = rpos - mpos;
        long long lsum = sum[mpos] - sum[lpos-1];
        long long rsum = sum[n] - sum[mpos];
        tot = (lcnt * loc[mpos]) - (lsum) + (rsum) - (rcnt * loc[mpos]);
        if(tot <= lim){
            return 1;
        }
    }
    return 0;
}
int besthub(int R, int L, int X[], long long B)
{
    n = R;
    for(int i=0; i<R; i++) loc[i+1] = X[i];
    for(int i=1;i<=R;i++){
        sum[i] += sum[i-1] + loc[i];
    }
    int low = 0;
    int high = R;
    while(low<=high){
        int mid = (low+high)/2;
        if(can(mid,B)){
            high = mid - 1;
        }
        else low = mid + 1;
    }
    return n-(high + 1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 248 KB Output is correct
2 Incorrect 1 ms 352 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 460 KB Output is correct
2 Correct 1 ms 460 KB Output is correct
3 Correct 1 ms 460 KB Output is correct
4 Correct 2 ms 532 KB Output is correct
5 Correct 2 ms 548 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 2 ms 640 KB Output is correct
8 Correct 2 ms 644 KB Output is correct
9 Correct 2 ms 648 KB Output is correct
10 Correct 2 ms 684 KB Output is correct
11 Correct 2 ms 720 KB Output is correct
12 Correct 1 ms 724 KB Output is correct
13 Correct 2 ms 744 KB Output is correct
14 Correct 1 ms 748 KB Output is correct
15 Correct 2 ms 752 KB Output is correct
16 Correct 2 ms 756 KB Output is correct
17 Correct 2 ms 760 KB Output is correct
18 Correct 2 ms 876 KB Output is correct
19 Correct 2 ms 876 KB Output is correct
20 Correct 2 ms 876 KB Output is correct
21 Correct 2 ms 876 KB Output is correct
22 Correct 2 ms 876 KB Output is correct
23 Correct 2 ms 876 KB Output is correct
24 Correct 2 ms 876 KB Output is correct
25 Correct 2 ms 876 KB Output is correct
26 Correct 2 ms 876 KB Output is correct
27 Correct 2 ms 876 KB Output is correct
28 Correct 2 ms 876 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 876 KB Output is correct
2 Correct 2 ms 876 KB Output is correct
3 Correct 2 ms 876 KB Output is correct
4 Correct 2 ms 876 KB Output is correct
5 Correct 2 ms 876 KB Output is correct
6 Correct 2 ms 876 KB Output is correct
7 Correct 2 ms 876 KB Output is correct
8 Correct 2 ms 880 KB Output is correct
9 Correct 2 ms 904 KB Output is correct
10 Correct 2 ms 908 KB Output is correct
11 Correct 2 ms 912 KB Output is correct
12 Correct 2 ms 1016 KB Output is correct
13 Correct 2 ms 1016 KB Output is correct
14 Correct 2 ms 1016 KB Output is correct
15 Incorrect 2 ms 1016 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 1348 KB Output is correct
2 Correct 6 ms 1404 KB Output is correct
3 Correct 21 ms 4040 KB Output is correct
4 Correct 29 ms 5100 KB Output is correct
5 Correct 11 ms 5100 KB Output is correct
6 Correct 14 ms 5100 KB Output is correct
7 Correct 22 ms 6596 KB Output is correct
8 Correct 29 ms 7368 KB Output is correct
9 Correct 11 ms 7368 KB Output is correct
10 Correct 11 ms 7368 KB Output is correct
11 Correct 22 ms 8972 KB Output is correct
12 Correct 21 ms 10036 KB Output is correct
13 Incorrect 13 ms 10036 KB Output isn't correct
14 Halted 0 ms 0 KB -