Submission #992572

# Submission time Handle Problem Language Result Execution time Memory
992572 2024-06-04T17:20:19 Z MrDeboo Rice Hub (IOI11_ricehub) C++17
0 / 100
2 ms 604 KB
#include "ricehub.h"
#include "bits/stdc++.h"
using namespace std;
int besthub(int r, int l, int x[], long long b){
    deque<pair<long long,long>>dq;
    int ans=0;
    for(int i=0;i<r;i++){
        dq.push_back({x[i]+(dq.empty()?0ll:dq.back().first),x[i]});
        while(dq.size()>1&&((dq.back().first-(dq[0].first-dq[0].second))-dq[dq.size()/2].second*(dq.size()-dq.size()/2))+(dq[dq.size()/2].second*(dq.size()/2-1)-(dq[dq.size()/2-1].first-(dq[0].first-dq[0].second)))>b)dq.pop_front();
        ans=max(ans,(int)dq.size());
    }
    return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:9:215: warning: comparison of integer expressions of different signedness: 'long long unsigned int' and 'long long int' [-Wsign-compare]
    9 |         while(dq.size()>1&&((dq.back().first-(dq[0].first-dq[0].second))-dq[dq.size()/2].second*(dq.size()-dq.size()/2))+(dq[dq.size()/2].second*(dq.size()/2-1)-(dq[dq.size()/2-1].first-(dq[0].first-dq[0].second)))>b)dq.pop_front();
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -