# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
333631 | 2020-12-07T09:33:57 Z | blue | 쌀 창고 (IOI11_ricehub) | C++11 | 26 ms | 2668 KB |
#include "ricehub.h" #include <vector> using namespace std; int besthub(int R, int L, int X[], long long B) //fields, max coordinate, i'th field, budget { int fields = R; vector<long long> F(R+2); F[0] = -(2e16 + 1); F[R+1] = (4e16 + 1); for(int i = 1; i <= R; i++) F[i] = X[i-1]; int l = 1; //leftmost field int m = 1; //hub int r = 1; //rightmost field long long c = 0; //current cost int res = 1; //running result while(1) { if(F[r+1] - F[m] + c <= B) { c += F[r+1] - F[m]; r++; } else if(F[m] - F[l] > F[r+1] - F[m]) { c -= (F[m] - F[l]); l++; } else if(m < R) {//l * * m m1 * r if(F[m+1] - F[m] > B) { l = m = r = m+1; c = 0; continue; } c += (F[m+1] - F[m]) * ((m - (l - 1)) - (r - m)); m++; while(c > B) { c -= F[m] - F[l]; l++; } } else break; res = max(res, r - l + 1); } return res; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 384 KB | Output is correct |
5 | Correct | 1 ms | 256 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 0 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 0 ms | 364 KB | Output is correct |
14 | Correct | 0 ms | 364 KB | Output is correct |
15 | Correct | 0 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Correct | 1 ms | 364 KB | Output is correct |
19 | Correct | 1 ms | 364 KB | Output is correct |
20 | Correct | 1 ms | 364 KB | Output is correct |
21 | Correct | 1 ms | 364 KB | Output is correct |
22 | Correct | 1 ms | 364 KB | Output is correct |
23 | Correct | 1 ms | 364 KB | Output is correct |
24 | Correct | 1 ms | 364 KB | Output is correct |
25 | Correct | 1 ms | 364 KB | Output is correct |
26 | Correct | 1 ms | 364 KB | Output is correct |
27 | Incorrect | 1 ms | 364 KB | Output isn't correct |
28 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 1 ms | 364 KB | Output is correct |
4 | Correct | 1 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 1 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 364 KB | Output is correct |
8 | Correct | 1 ms | 364 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 4 ms | 364 KB | Output is correct |
11 | Correct | 1 ms | 364 KB | Output is correct |
12 | Correct | 1 ms | 364 KB | Output is correct |
13 | Correct | 1 ms | 364 KB | Output is correct |
14 | Correct | 1 ms | 364 KB | Output is correct |
15 | Correct | 1 ms | 364 KB | Output is correct |
16 | Correct | 1 ms | 364 KB | Output is correct |
17 | Correct | 1 ms | 364 KB | Output is correct |
18 | Incorrect | 1 ms | 364 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 620 KB | Output is correct |
2 | Correct | 3 ms | 620 KB | Output is correct |
3 | Correct | 17 ms | 2540 KB | Output is correct |
4 | Correct | 17 ms | 2540 KB | Output is correct |
5 | Correct | 8 ms | 1260 KB | Output is correct |
6 | Correct | 8 ms | 1260 KB | Output is correct |
7 | Correct | 17 ms | 2284 KB | Output is correct |
8 | Correct | 15 ms | 2284 KB | Output is correct |
9 | Correct | 7 ms | 1132 KB | Output is correct |
10 | Correct | 7 ms | 1132 KB | Output is correct |
11 | Correct | 17 ms | 2668 KB | Output is correct |
12 | Correct | 25 ms | 2668 KB | Output is correct |
13 | Correct | 8 ms | 1260 KB | Output is correct |
14 | Correct | 10 ms | 1260 KB | Output is correct |
15 | Correct | 13 ms | 1900 KB | Output is correct |
16 | Correct | 19 ms | 1900 KB | Output is correct |
17 | Correct | 15 ms | 2284 KB | Output is correct |
18 | Correct | 16 ms | 2412 KB | Output is correct |
19 | Correct | 16 ms | 2412 KB | Output is correct |
20 | Correct | 26 ms | 2412 KB | Output is correct |