답안 #64664

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
64664 2018-08-05T10:49:35 Z alenam0161 쌀 창고 (IOI11_ricehub) C++17
68 / 100
35 ms 8840 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
  int l=1;
  int r=R;
  int ans=1;
  while(l<=r){
    int mid=(l+r)/2;
    int curpos=0;
    int hwl=1;
    int hwr=mid-1;
    long long cur=0;
    int cl=0;int cr=mid-1;
    for(int i=1;i<mid;++i){
        cur+=X[i]-X[0];
    }
  //  cout<<mid<<" "<<cur<<endl;
    if(cur<=B){
        ans=mid;
        l=mid+1;
        continue;
    }
   // cout<<"h"<<endl;
    bool ok=true;
    while(cr<R){
        while(hwl<hwr&&curpos<cr){
            cur-=(hwr-hwl)*(X[curpos+1]-X[curpos]);
            hwl++;hwr--;
            curpos++;
        }
    //    cout<<cur<<" "<<hwl<<" "<<hwr<<" "<<cl<<" "<<cr<<endl;
        if(cur<=B){
            ok=false;
            break;
        }
        cl++;cr++;
        hwl--;hwr++;
        cur-=X[curpos]-X[cl-1];
        cur+=X[cr]-X[curpos];
    }
    if(ok){
        r=mid-1;
    }
    else{
        ans=mid;
        l=mid+1;
    }
  }
  return ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 504 KB Output is correct
2 Correct 3 ms 504 KB Output is correct
3 Correct 3 ms 504 KB Output is correct
4 Correct 3 ms 504 KB Output is correct
5 Correct 3 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 564 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 2 ms 604 KB Output is correct
4 Correct 3 ms 604 KB Output is correct
5 Correct 2 ms 604 KB Output is correct
6 Correct 3 ms 628 KB Output is correct
7 Correct 3 ms 628 KB Output is correct
8 Correct 3 ms 788 KB Output is correct
9 Correct 3 ms 788 KB Output is correct
10 Correct 3 ms 788 KB Output is correct
11 Correct 3 ms 788 KB Output is correct
12 Correct 4 ms 788 KB Output is correct
13 Correct 3 ms 788 KB Output is correct
14 Correct 4 ms 788 KB Output is correct
15 Correct 4 ms 788 KB Output is correct
16 Correct 2 ms 788 KB Output is correct
17 Correct 3 ms 788 KB Output is correct
18 Correct 2 ms 788 KB Output is correct
19 Correct 3 ms 788 KB Output is correct
20 Correct 3 ms 788 KB Output is correct
21 Correct 3 ms 788 KB Output is correct
22 Correct 3 ms 788 KB Output is correct
23 Correct 4 ms 788 KB Output is correct
24 Correct 3 ms 788 KB Output is correct
25 Correct 3 ms 788 KB Output is correct
26 Correct 3 ms 788 KB Output is correct
27 Correct 2 ms 788 KB Output is correct
28 Correct 3 ms 788 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 788 KB Output is correct
2 Correct 3 ms 788 KB Output is correct
3 Correct 3 ms 788 KB Output is correct
4 Correct 4 ms 788 KB Output is correct
5 Correct 2 ms 788 KB Output is correct
6 Correct 3 ms 788 KB Output is correct
7 Correct 3 ms 800 KB Output is correct
8 Correct 3 ms 800 KB Output is correct
9 Correct 4 ms 812 KB Output is correct
10 Correct 4 ms 812 KB Output is correct
11 Correct 4 ms 828 KB Output is correct
12 Correct 3 ms 832 KB Output is correct
13 Correct 3 ms 840 KB Output is correct
14 Correct 3 ms 848 KB Output is correct
15 Correct 3 ms 856 KB Output is correct
16 Correct 2 ms 856 KB Output is correct
17 Correct 3 ms 864 KB Output is correct
18 Correct 3 ms 872 KB Output is correct
19 Correct 3 ms 992 KB Output is correct
20 Correct 2 ms 992 KB Output is correct
21 Correct 4 ms 1024 KB Output is correct
22 Correct 6 ms 1024 KB Output is correct
23 Correct 4 ms 1024 KB Output is correct
24 Correct 5 ms 1024 KB Output is correct
25 Correct 5 ms 1024 KB Output is correct
26 Correct 5 ms 1124 KB Output is correct
27 Correct 6 ms 1124 KB Output is correct
28 Correct 5 ms 1128 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 1296 KB Output is correct
2 Correct 6 ms 1432 KB Output is correct
3 Correct 24 ms 2848 KB Output is correct
4 Correct 25 ms 3912 KB Output is correct
5 Correct 13 ms 4080 KB Output is correct
6 Correct 17 ms 4356 KB Output is correct
7 Correct 22 ms 5312 KB Output is correct
8 Correct 19 ms 6172 KB Output is correct
9 Correct 12 ms 6176 KB Output is correct
10 Correct 13 ms 6464 KB Output is correct
11 Correct 23 ms 7776 KB Output is correct
12 Incorrect 35 ms 8840 KB Output isn't correct
13 Halted 0 ms 0 KB -