답안 #56498

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
56498 2018-07-11T13:48:48 Z Bodo171 쌀 창고 (IOI11_ricehub) C++14
100 / 100
31 ms 17032 KB
#include "ricehub.h"
#include <iostream>
const int nmax=100005;
long long v[nmax],sum[nmax];
int i,p,mx;
long long S(int l,int r)
{
    return sum[r]-sum[l-1];
}
long long cost(int st,int dr)
{
    int poz=(st+dr)/2;
    return (1LL*(poz-st+1)*v[poz]-S(st,poz)+S(poz+1,dr)-1LL*(dr-poz)*v[poz]);
}
int besthub(int R, int L, int X[], long long B)
{
  for(i=1;i<=R;i++)
    sum[i]=X[i-1]+sum[i-1],v[i]=X[i-1];
  p=1;
  for(i=1;i<=R;i++)
  {
      while(cost(p,i)>B)
        p++;
      if(i-p+1>mx)
        mx=i-p+1;
  }
  return mx;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 576 KB Output is correct
2 Correct 3 ms 660 KB Output is correct
3 Correct 3 ms 660 KB Output is correct
4 Correct 2 ms 676 KB Output is correct
5 Correct 2 ms 752 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 884 KB Output is correct
2 Correct 2 ms 916 KB Output is correct
3 Correct 2 ms 932 KB Output is correct
4 Correct 4 ms 936 KB Output is correct
5 Correct 4 ms 936 KB Output is correct
6 Correct 2 ms 944 KB Output is correct
7 Correct 3 ms 948 KB Output is correct
8 Correct 2 ms 952 KB Output is correct
9 Correct 2 ms 956 KB Output is correct
10 Correct 3 ms 960 KB Output is correct
11 Correct 2 ms 964 KB Output is correct
12 Correct 2 ms 968 KB Output is correct
13 Correct 3 ms 972 KB Output is correct
14 Correct 2 ms 1032 KB Output is correct
15 Correct 3 ms 1032 KB Output is correct
16 Correct 2 ms 1040 KB Output is correct
17 Correct 2 ms 1044 KB Output is correct
18 Correct 3 ms 1048 KB Output is correct
19 Correct 2 ms 1052 KB Output is correct
20 Correct 3 ms 1056 KB Output is correct
21 Correct 3 ms 1060 KB Output is correct
22 Correct 3 ms 1064 KB Output is correct
23 Correct 2 ms 1064 KB Output is correct
24 Correct 3 ms 1072 KB Output is correct
25 Correct 4 ms 1076 KB Output is correct
26 Correct 3 ms 1080 KB Output is correct
27 Correct 2 ms 1084 KB Output is correct
28 Correct 2 ms 1088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 1092 KB Output is correct
2 Correct 3 ms 1096 KB Output is correct
3 Correct 2 ms 1100 KB Output is correct
4 Correct 4 ms 1108 KB Output is correct
5 Correct 3 ms 1132 KB Output is correct
6 Correct 3 ms 1136 KB Output is correct
7 Correct 3 ms 1152 KB Output is correct
8 Correct 3 ms 1168 KB Output is correct
9 Correct 2 ms 1176 KB Output is correct
10 Correct 2 ms 1180 KB Output is correct
11 Correct 2 ms 1184 KB Output is correct
12 Correct 2 ms 1208 KB Output is correct
13 Correct 2 ms 1216 KB Output is correct
14 Correct 2 ms 1240 KB Output is correct
15 Correct 3 ms 1248 KB Output is correct
16 Correct 3 ms 1252 KB Output is correct
17 Correct 3 ms 1256 KB Output is correct
18 Correct 3 ms 1256 KB Output is correct
19 Correct 2 ms 1272 KB Output is correct
20 Correct 2 ms 1280 KB Output is correct
21 Correct 4 ms 1320 KB Output is correct
22 Correct 3 ms 1440 KB Output is correct
23 Correct 3 ms 1464 KB Output is correct
24 Correct 4 ms 1496 KB Output is correct
25 Correct 4 ms 1528 KB Output is correct
26 Correct 5 ms 1572 KB Output is correct
27 Correct 4 ms 1736 KB Output is correct
28 Correct 3 ms 1736 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 9 ms 2096 KB Output is correct
2 Correct 6 ms 2228 KB Output is correct
3 Correct 19 ms 4796 KB Output is correct
4 Correct 19 ms 5844 KB Output is correct
5 Correct 9 ms 5844 KB Output is correct
6 Correct 9 ms 5844 KB Output is correct
7 Correct 16 ms 7348 KB Output is correct
8 Correct 17 ms 8120 KB Output is correct
9 Correct 11 ms 8120 KB Output is correct
10 Correct 18 ms 8120 KB Output is correct
11 Correct 25 ms 9728 KB Output is correct
12 Correct 27 ms 10788 KB Output is correct
13 Correct 12 ms 10788 KB Output is correct
14 Correct 11 ms 10788 KB Output is correct
15 Correct 16 ms 11860 KB Output is correct
16 Correct 21 ms 12648 KB Output is correct
17 Correct 31 ms 14124 KB Output is correct
18 Correct 30 ms 14956 KB Output is correct
19 Correct 29 ms 16028 KB Output is correct
20 Correct 26 ms 17032 KB Output is correct