답안 #992586

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
992586 2024-06-04T17:54:57 Z MrDeboo 쌀 창고 (IOI11_ricehub) C++17
100 / 100
12 ms 5268 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[dq.size()/2-1].first)-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:210: 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[dq.size()/2-1].first)-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 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 452 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 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 440 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 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 348 KB Output is correct
15 Correct 0 ms 452 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 1 ms 344 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 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 0 ms 348 KB Output is correct
27 Correct 1 ms 348 KB Output is correct
28 Correct 0 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 448 KB Output is correct
3 Correct 0 ms 448 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 396 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 0 ms 392 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 1 ms 344 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 1 ms 604 KB Output is correct
17 Correct 1 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 600 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 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 348 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 660 KB Output is correct
2 Correct 3 ms 604 KB Output is correct
3 Correct 12 ms 5224 KB Output is correct
4 Correct 10 ms 5268 KB Output is correct
5 Correct 5 ms 2908 KB Output is correct
6 Correct 5 ms 2904 KB Output is correct
7 Correct 9 ms 4956 KB Output is correct
8 Correct 9 ms 4956 KB Output is correct
9 Correct 5 ms 2908 KB Output is correct
10 Correct 4 ms 3068 KB Output is correct
11 Correct 10 ms 5148 KB Output is correct
12 Correct 11 ms 5212 KB Output is correct
13 Correct 6 ms 2908 KB Output is correct
14 Correct 4 ms 2908 KB Output is correct
15 Correct 8 ms 4624 KB Output is correct
16 Correct 8 ms 4444 KB Output is correct
17 Correct 9 ms 4888 KB Output is correct
18 Correct 9 ms 4956 KB Output is correct
19 Correct 12 ms 5212 KB Output is correct
20 Correct 10 ms 5208 KB Output is correct