답안 #1036213

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1036213 2024-07-27T05:34:16 Z HappyCapybara 쌀 창고 (IOI11_ricehub) C++17
49 / 100
10 ms 2764 KB
#include "ricehub.h"
#include<bits/stdc++.h>
using namespace std;

#define ll long long

int besthub(int R, int L, int X[], ll B){
  queue<ll> l, r;
  for (int i=0; i<R; i++) r.push(X[i]);

  int bsf = 0, curl = 0, curr = 0, i = 0;
  ll k = 0;
  while (true){
    while ((!r.empty() && ((k+(r.front()-(ll) X[i])) <= B)) || (!l.empty() && !r.empty() && curl && (r.front()-X[i]) < (X[i]-l.front()))){
      while (!r.empty() && ((k+(r.front()-(ll) X[i])) <= B)){
        k += r.front()- (ll) X[i];
        l.push(r.front());
        r.pop();
        curr++;
      }
      if (!l.empty() && !r.empty() && curl && (r.front()-X[i]) < (X[i]-l.front())){
        k += r.front()+l.front()-2ll* (ll) X[i];
        l.pop();
        l.push(r.front());
        r.pop();
        curl--;
        curr++;
      }
    }
    if (k <= B) bsf = max(bsf, curl+curr);
    //cout << i << " " << curl << " " << curr << " " << k << " " << bsf << "\n";
    i++;
    if (i == R) break;
    curl++; curr--;
    k += (ll) (curl-curr) * (ll) (X[i]-X[i-1]);
  }

  return bsf;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 344 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 600 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 456 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Incorrect 0 ms 344 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 448 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 1 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 1 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 604 KB Output is correct
2 Correct 2 ms 644 KB Output is correct
3 Correct 9 ms 2652 KB Output is correct
4 Correct 9 ms 2608 KB Output is correct
5 Correct 4 ms 1368 KB Output is correct
6 Correct 4 ms 1376 KB Output is correct
7 Correct 9 ms 2392 KB Output is correct
8 Correct 8 ms 2228 KB Output is correct
9 Correct 4 ms 1116 KB Output is correct
10 Correct 5 ms 1116 KB Output is correct
11 Correct 9 ms 2764 KB Output is correct
12 Correct 9 ms 2652 KB Output is correct
13 Correct 4 ms 1372 KB Output is correct
14 Correct 5 ms 1288 KB Output is correct
15 Correct 7 ms 1940 KB Output is correct
16 Correct 7 ms 1988 KB Output is correct
17 Correct 8 ms 2348 KB Output is correct
18 Correct 10 ms 2396 KB Output is correct
19 Correct 9 ms 2396 KB Output is correct
20 Correct 9 ms 2592 KB Output is correct