답안 #895147

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
895147 2023-12-29T13:29:27 Z anton 쌀 창고 (IOI11_ricehub) C++17
100 / 100
15 ms 4596 KB
#include "ricehub.h"

#include<bits/stdc++.h>
using namespace std;
#define ll long long
struct Hull{
  deque<ll> dq;
  ll s;
  
  Hull(){
    s= 0;
  }

  void add(ll pos){
    if(dq.size()>0){
      s += pos-dq[(dq.size())/2];
    }
    dq.push_back(pos);
  }

  void rem(){
    ll pos = dq.front();
    s-= dq[(dq.size())/2] -pos;
    dq.pop_front();
  }
};

int besthub(int R, int L, int X[], long long B){

  Hull my_hull;
  int res= 0;
  for(int i = 0; i<R; i++){
    my_hull.add(X[i]);
    while(my_hull.s>B){
      my_hull.rem();
    }

    if(my_hull.dq.size()>res){
      res=my_hull.dq.size();
    }
  }
  return res;

}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:38:25: warning: comparison of integer expressions of different signedness: 'std::deque<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   38 |     if(my_hull.dq.size()>res){
      |        ~~~~~~~~~~~~~~~~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 448 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 1 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 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 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 1 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 1 ms 344 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 0 ms 436 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 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 0 ms 344 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 1 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 420 KB Output is correct
13 Correct 0 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 1 ms 352 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 1 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 456 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 352 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 436 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 356 KB Output is correct
3 Correct 15 ms 3448 KB Output is correct
4 Correct 9 ms 3444 KB Output is correct
5 Correct 6 ms 2656 KB Output is correct
6 Correct 4 ms 2916 KB Output is correct
7 Correct 12 ms 4164 KB Output is correct
8 Correct 9 ms 4188 KB Output is correct
9 Correct 5 ms 3028 KB Output is correct
10 Correct 4 ms 3016 KB Output is correct
11 Correct 10 ms 4332 KB Output is correct
12 Correct 9 ms 4532 KB Output is correct
13 Correct 5 ms 3016 KB Output is correct
14 Correct 5 ms 2920 KB Output is correct
15 Correct 8 ms 4024 KB Output is correct
16 Correct 8 ms 3944 KB Output is correct
17 Correct 9 ms 4200 KB Output is correct
18 Correct 9 ms 4116 KB Output is correct
19 Correct 11 ms 4448 KB Output is correct
20 Correct 13 ms 4596 KB Output is correct