# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
551235 | 2022-04-20T06:11:47 Z | alireza_kaviani | 쌀 창고 (IOI11_ricehub) | C++17 | 31 ms | 2612 KB |
#include "ricehub.h" #include <bits/stdc++.h> using namespace std; typedef long long ll; const ll MAXN = 1e5 + 10; ll n , k , A[MAXN] , ps[MAXN]; int check(ll x){ ll l = x / 2 , r = x - l - 1; for(int i = 1 ; i + x <= n + 1 ; i++){ ll cost = ps[i + x - 1] - ps[i + l] - ps[i + l - 1] + ps[i - 1] + A[i + l] * (l - r); if(cost <= k) return 1; } return 0; } int besthub(int R, int L, int X[], long long B){ n = R; k = B; for(int i = 1 ; i <= n ; i++){ A[i] = X[i - 1]; ps[i] = A[i] + ps[i - 1]; } ll l = 1 , r = n + 1; while(r - l > 1){ int mid = l + r >> 1; if(check(mid)) l = mid; else r = mid; } return l; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 312 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 0 ms | 212 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 340 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 304 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 212 KB | Output is correct |
8 | Correct | 0 ms | 212 KB | Output is correct |
9 | Correct | 1 ms | 308 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 308 KB | Output is correct |
12 | Correct | 1 ms | 212 KB | Output is correct |
13 | Correct | 1 ms | 212 KB | Output is correct |
14 | Correct | 1 ms | 212 KB | Output is correct |
15 | Correct | 1 ms | 212 KB | Output is correct |
16 | Correct | 1 ms | 308 KB | Output is correct |
17 | Correct | 1 ms | 212 KB | Output is correct |
18 | Correct | 1 ms | 212 KB | Output is correct |
19 | Correct | 1 ms | 212 KB | Output is correct |
20 | Correct | 1 ms | 312 KB | Output is correct |
21 | Correct | 1 ms | 212 KB | Output is correct |
22 | Correct | 1 ms | 308 KB | Output is correct |
23 | Correct | 1 ms | 212 KB | Output is correct |
24 | Correct | 1 ms | 212 KB | Output is correct |
25 | Correct | 1 ms | 212 KB | Output is correct |
26 | Correct | 1 ms | 212 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 1 ms | 212 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 212 KB | Output is correct |
2 | Correct | 1 ms | 212 KB | Output is correct |
3 | Correct | 1 ms | 308 KB | Output is correct |
4 | Correct | 1 ms | 212 KB | Output is correct |
5 | Correct | 1 ms | 212 KB | Output is correct |
6 | Correct | 1 ms | 212 KB | Output is correct |
7 | Correct | 1 ms | 340 KB | Output is correct |
8 | Correct | 1 ms | 340 KB | Output is correct |
9 | Correct | 1 ms | 212 KB | Output is correct |
10 | Correct | 1 ms | 212 KB | Output is correct |
11 | Correct | 1 ms | 316 KB | Output is correct |
12 | Correct | 1 ms | 340 KB | Output is correct |
13 | Correct | 1 ms | 340 KB | Output is correct |
14 | Correct | 1 ms | 308 KB | Output is correct |
15 | Correct | 1 ms | 340 KB | Output is correct |
16 | Correct | 1 ms | 340 KB | Output is correct |
17 | Correct | 1 ms | 340 KB | Output is correct |
18 | Correct | 1 ms | 340 KB | Output is correct |
19 | Correct | 1 ms | 312 KB | Output is correct |
20 | Correct | 1 ms | 340 KB | Output is correct |
21 | Correct | 1 ms | 316 KB | Output is correct |
22 | Correct | 2 ms | 348 KB | Output is correct |
23 | Correct | 2 ms | 340 KB | Output is correct |
24 | Correct | 1 ms | 452 KB | Output is correct |
25 | Correct | 1 ms | 340 KB | Output is correct |
26 | Correct | 2 ms | 456 KB | Output is correct |
27 | Correct | 1 ms | 340 KB | Output is correct |
28 | Correct | 2 ms | 344 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 728 KB | Output is correct |
2 | Correct | 3 ms | 728 KB | Output is correct |
3 | Correct | 31 ms | 2440 KB | Output is correct |
4 | Correct | 18 ms | 2380 KB | Output is correct |
5 | Correct | 7 ms | 1620 KB | Output is correct |
6 | Correct | 6 ms | 1580 KB | Output is correct |
7 | Correct | 11 ms | 2596 KB | Output is correct |
8 | Correct | 14 ms | 2612 KB | Output is correct |
9 | Correct | 6 ms | 1560 KB | Output is correct |
10 | Correct | 8 ms | 1456 KB | Output is correct |
11 | Correct | 16 ms | 2584 KB | Output is correct |
12 | Correct | 18 ms | 2584 KB | Output is correct |
13 | Correct | 7 ms | 1584 KB | Output is correct |
14 | Correct | 7 ms | 1572 KB | Output is correct |
15 | Correct | 10 ms | 2036 KB | Output is correct |
16 | Correct | 11 ms | 2124 KB | Output is correct |
17 | Correct | 13 ms | 2316 KB | Output is correct |
18 | Correct | 13 ms | 2424 KB | Output is correct |
19 | Correct | 13 ms | 2520 KB | Output is correct |
20 | Correct | 14 ms | 2556 KB | Output is correct |