# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
317135 | 2020-10-29T04:00:49 Z | nandonathaniel | 쌀 창고 (IOI11_ricehub) | C++14 | 19 ms | 1792 KB |
#include "ricehub.h" #include "bits/stdc++.h" using namespace std; int besthub(int R, int L, int X[], long long B) { int ki=1,ka=R,res; while(ki<=ka){ int mid=(ki+ka)/2; long long cost=0; int idx=(mid-1)/2; for(int i=0;i<mid;i++)cost+=abs(X[i]-X[idx]); long long mini=cost; for(int i=mid;i<R;i++){ cost-=abs(X[i-mid]-X[idx]); idx++; int selisih=X[idx]-X[idx-1]; cost-=(1LL*(i-idx)*selisih); cost+=(1LL*(mid-1-i+idx)*selisih); cost+=abs(X[i]-X[idx]); mini=min(mini,cost); } if(mini<=B){ res=mid; ki=mid+1; } else ka=mid-1; } return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 256 KB | Output is correct |
4 | Correct | 1 ms | 256 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
6 | Correct | 1 ms | 256 KB | Output is correct |
7 | Correct | 1 ms | 256 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 384 KB | Output is correct |
11 | Correct | 1 ms | 256 KB | Output is correct |
12 | Correct | 1 ms | 256 KB | Output is correct |
13 | Correct | 1 ms | 384 KB | Output is correct |
14 | Correct | 1 ms | 256 KB | Output is correct |
15 | Correct | 1 ms | 256 KB | Output is correct |
16 | Correct | 1 ms | 256 KB | Output is correct |
17 | Correct | 1 ms | 256 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 1 ms | 256 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
22 | Correct | 1 ms | 384 KB | Output is correct |
23 | Correct | 1 ms | 384 KB | Output is correct |
24 | Correct | 1 ms | 384 KB | Output is correct |
25 | Correct | 1 ms | 256 KB | Output is correct |
26 | Correct | 1 ms | 384 KB | Output is correct |
27 | Correct | 1 ms | 256 KB | Output is correct |
28 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 256 KB | Output is correct |
3 | Correct | 1 ms | 384 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 1 ms | 384 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 384 KB | Output is correct |
9 | Correct | 1 ms | 256 KB | Output is correct |
10 | Correct | 1 ms | 256 KB | Output is correct |
11 | Correct | 1 ms | 384 KB | Output is correct |
12 | Correct | 1 ms | 384 KB | Output is correct |
13 | Correct | 1 ms | 288 KB | Output is correct |
14 | Correct | 1 ms | 512 KB | Output is correct |
15 | Correct | 1 ms | 384 KB | Output is correct |
16 | Correct | 1 ms | 256 KB | Output is correct |
17 | Correct | 1 ms | 384 KB | Output is correct |
18 | Correct | 1 ms | 384 KB | Output is correct |
19 | Correct | 1 ms | 384 KB | Output is correct |
20 | Correct | 1 ms | 384 KB | Output is correct |
21 | Correct | 1 ms | 384 KB | Output is correct |
22 | Correct | 1 ms | 384 KB | Output is correct |
23 | Correct | 1 ms | 384 KB | Output is correct |
24 | Correct | 1 ms | 384 KB | Output is correct |
25 | Correct | 1 ms | 384 KB | Output is correct |
26 | Correct | 1 ms | 384 KB | Output is correct |
27 | Correct | 2 ms | 384 KB | Output is correct |
28 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 512 KB | Output is correct |
2 | Correct | 4 ms | 512 KB | Output is correct |
3 | Correct | 19 ms | 1792 KB | Output is correct |
4 | Correct | 19 ms | 1792 KB | Output is correct |
5 | Correct | 11 ms | 896 KB | Output is correct |
6 | Correct | 9 ms | 896 KB | Output is correct |
7 | Correct | 16 ms | 1536 KB | Output is correct |
8 | Correct | 15 ms | 1536 KB | Output is correct |
9 | Correct | 9 ms | 896 KB | Output is correct |
10 | Correct | 9 ms | 768 KB | Output is correct |
11 | Correct | 19 ms | 1792 KB | Output is correct |
12 | Correct | 19 ms | 1792 KB | Output is correct |
13 | Correct | 10 ms | 896 KB | Output is correct |
14 | Correct | 10 ms | 1024 KB | Output is correct |
15 | Correct | 15 ms | 1408 KB | Output is correct |
16 | Correct | 14 ms | 1408 KB | Output is correct |
17 | Correct | 17 ms | 1664 KB | Output is correct |
18 | Correct | 17 ms | 1664 KB | Output is correct |
19 | Correct | 18 ms | 1664 KB | Output is correct |
20 | Correct | 18 ms | 1664 KB | Output is correct |