Submission #895144

# Submission time Handle Problem Language Result Execution time Memory
895144 2023-12-29T13:28:09 Z anton Rice Hub (IOI11_ricehub) C++17
0 / 100
9 ms 3432 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){
    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:36:25: warning: comparison of integer expressions of different signedness: 'std::deque<long long int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(my_hull.dq.size()>res){
      |        ~~~~~~~~~~~~~~~~~^~~~
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 344 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 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 0 ms 344 KB Output is correct
5 Incorrect 0 ms 348 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 348 KB Output is correct
2 Correct 2 ms 348 KB Output is correct
3 Correct 9 ms 3420 KB Output is correct
4 Correct 9 ms 3432 KB Output is correct
5 Incorrect 4 ms 2552 KB Output isn't correct
6 Halted 0 ms 0 KB -