# |
제출 시각 |
아이디 |
문제 |
언어 |
결과 |
실행 시간 |
메모리 |
121050 |
2019-06-26T04:09:01 Z |
송준혁(#2942) |
쌀 창고 (IOI11_ricehub) |
C++14 |
|
18 ms |
2560 KB |
#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;
typedef long long LL;
typedef pair<int, int> pii;
int N, ans;
LL B;
LL A[101010];
bool chk(int k){
LL sum = 0;
int m = (k+1)/2;
for (int i=1; i<=k; i++) sum += abs(A[m] - A[i]);
if (sum <= B) return true;
m++;
for (int i=2; i+k-1<=N; i++, m++){
if (k&1) sum += A[m] - A[m-1];
sum -= A[m] - A[i-1];
sum += A[i+k-1] - A[m];
if (sum <= B) return true;
}
return false;
}
int besthub(int n, int asdf, int X[], long long b){
N = n, B = b;
for (int i=1; i<=N; i++) A[i] = X[i-1];
int L=0, R=N;
while (L<=R){
int mid = (L+R)/2;
if (chk(mid)) ans = mid, L = mid+1;
else R = mid-1;
}
return ans;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
384 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
256 KB |
Output is correct |
15 |
Correct |
2 ms |
256 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
384 KB |
Output is correct |
18 |
Correct |
2 ms |
384 KB |
Output is correct |
19 |
Correct |
2 ms |
384 KB |
Output is correct |
20 |
Correct |
2 ms |
384 KB |
Output is correct |
21 |
Correct |
2 ms |
384 KB |
Output is correct |
22 |
Correct |
2 ms |
384 KB |
Output is correct |
23 |
Correct |
2 ms |
384 KB |
Output is correct |
24 |
Correct |
2 ms |
384 KB |
Output is correct |
25 |
Correct |
2 ms |
384 KB |
Output is correct |
26 |
Correct |
2 ms |
384 KB |
Output is correct |
27 |
Correct |
2 ms |
384 KB |
Output is correct |
28 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
256 KB |
Output is correct |
2 |
Correct |
2 ms |
256 KB |
Output is correct |
3 |
Correct |
2 ms |
384 KB |
Output is correct |
4 |
Correct |
2 ms |
384 KB |
Output is correct |
5 |
Correct |
2 ms |
384 KB |
Output is correct |
6 |
Correct |
2 ms |
384 KB |
Output is correct |
7 |
Correct |
2 ms |
384 KB |
Output is correct |
8 |
Correct |
2 ms |
384 KB |
Output is correct |
9 |
Correct |
2 ms |
384 KB |
Output is correct |
10 |
Correct |
2 ms |
384 KB |
Output is correct |
11 |
Correct |
2 ms |
384 KB |
Output is correct |
12 |
Correct |
2 ms |
384 KB |
Output is correct |
13 |
Correct |
2 ms |
384 KB |
Output is correct |
14 |
Correct |
2 ms |
384 KB |
Output is correct |
15 |
Correct |
2 ms |
384 KB |
Output is correct |
16 |
Correct |
2 ms |
384 KB |
Output is correct |
17 |
Correct |
2 ms |
384 KB |
Output is correct |
18 |
Correct |
2 ms |
384 KB |
Output is correct |
19 |
Correct |
3 ms |
384 KB |
Output is correct |
20 |
Correct |
2 ms |
384 KB |
Output is correct |
21 |
Correct |
2 ms |
384 KB |
Output is correct |
22 |
Correct |
3 ms |
384 KB |
Output is correct |
23 |
Correct |
3 ms |
384 KB |
Output is correct |
24 |
Correct |
3 ms |
384 KB |
Output is correct |
25 |
Correct |
2 ms |
512 KB |
Output is correct |
26 |
Correct |
2 ms |
384 KB |
Output is correct |
27 |
Correct |
3 ms |
512 KB |
Output is correct |
28 |
Correct |
3 ms |
424 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
640 KB |
Output is correct |
2 |
Correct |
4 ms |
640 KB |
Output is correct |
3 |
Correct |
16 ms |
2544 KB |
Output is correct |
4 |
Correct |
17 ms |
2560 KB |
Output is correct |
5 |
Correct |
8 ms |
1280 KB |
Output is correct |
6 |
Correct |
8 ms |
1280 KB |
Output is correct |
7 |
Correct |
14 ms |
2296 KB |
Output is correct |
8 |
Correct |
15 ms |
2304 KB |
Output is correct |
9 |
Correct |
8 ms |
1280 KB |
Output is correct |
10 |
Correct |
8 ms |
1280 KB |
Output is correct |
11 |
Correct |
18 ms |
2560 KB |
Output is correct |
12 |
Correct |
18 ms |
2560 KB |
Output is correct |
13 |
Correct |
8 ms |
1280 KB |
Output is correct |
14 |
Correct |
8 ms |
1280 KB |
Output is correct |
15 |
Correct |
13 ms |
1920 KB |
Output is correct |
16 |
Correct |
16 ms |
1920 KB |
Output is correct |
17 |
Correct |
16 ms |
2336 KB |
Output is correct |
18 |
Correct |
16 ms |
2304 KB |
Output is correct |
19 |
Correct |
18 ms |
2424 KB |
Output is correct |
20 |
Correct |
17 ms |
2432 KB |
Output is correct |