답안 #992577

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
992577 2024-06-04T17:45:15 Z MrDeboo 쌀 창고 (IOI11_ricehub) C++17
0 / 100
2 ms 600 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({(long long)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)-(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:213: 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)-(dq[dq.size()/2-1].first-(dq[0].first-dq[0].second)))>b)dq.pop_front();
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 600 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -