답안 #1036201

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

#define ll long long

int besthub(int R, int L, int X[], long long B){
  queue<int> 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 (!l.empty() && !r.empty() && curl && (r.front()-X[i]) < (X[i]-l.front())){
      //cout << "b\n";
      k += r.front()+l.front()-2*X[i];
      l.pop();
      l.push(r.front());
      r.pop();
      curl--;
      curr++;
    }
    //cout << k << " " << r.front() << " " << X[i] << " " << B << "\n";
    while (!r.empty() && ((k+(r.front()-X[i])) <= B)){
      //cout << "a\n";
      k += r.front()-X[i];
      l.push(r.front());
      r.pop();
      curr++;
    }
    if (k <= B) bsf = max(bsf, curl+curr);
    //cout << i << " " << curl << " " << curr << " " << k << " " << bsf << "\n";
    i++;
    if (i == R) break;
    curl++; curr--;
    k += (curl-curr)*(X[i]-X[i-1]);
  }

  return bsf;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 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 0 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 0 ms 348 KB Output is correct
5 Correct 0 ms 600 KB Output is correct
6 Correct 0 ms 604 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 1 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 452 KB Output is correct
13 Correct 0 ms 348 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 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 448 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Incorrect 0 ms 348 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 0 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 0 ms 348 KB Output is correct
11 Correct 0 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 452 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 0 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 860 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 9 ms 2140 KB Output is correct
4 Correct 9 ms 2144 KB Output is correct
5 Correct 4 ms 1116 KB Output is correct
6 Correct 5 ms 1116 KB Output is correct
7 Correct 8 ms 1816 KB Output is correct
8 Correct 8 ms 1856 KB Output is correct
9 Correct 4 ms 1116 KB Output is correct
10 Correct 4 ms 1116 KB Output is correct
11 Correct 9 ms 2164 KB Output is correct
12 Incorrect 9 ms 2348 KB Output isn't correct
13 Halted 0 ms 0 KB -