답안 #724759

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
724759 2023-04-15T23:29:31 Z Yell0 쌀 창고 (IOI11_ricehub) C++17
100 / 100
16 ms 972 KB
#include <bits/stdc++.h>

using namespace std;
typedef long long ll;

int besthub(int R,int L,int X[],ll B) {
  int ans=1;
  ll cost=0;
  for(int l=0,r=0;r<R;++r) {
    cost+=X[r]-X[(l+r)/2];
    while(cost>B) cost-=X[(l+r+1)/2]-X[l++];
    ans=max(ans,r-l+1);
  }
  return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, ll)':
ricehub.cpp:11:41: warning: operation on 'l' may be undefined [-Wsequence-point]
   11 |     while(cost>B) cost-=X[(l+r+1)/2]-X[l++];
      |                                        ~^~
ricehub.cpp:11:41: warning: operation on 'l' may be undefined [-Wsequence-point]
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 312 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 1 ms 312 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 308 KB Output is correct
23 Correct 1 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 284 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 212 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 312 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 312 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 312 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 1 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 0 ms 212 KB Output is correct
18 Correct 1 ms 212 KB Output is correct
19 Correct 1 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 1 ms 340 KB Output is correct
22 Correct 1 ms 344 KB Output is correct
23 Correct 1 ms 324 KB Output is correct
24 Correct 1 ms 340 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 340 KB Output is correct
27 Correct 1 ms 340 KB Output is correct
28 Correct 2 ms 320 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 448 KB Output is correct
3 Correct 13 ms 944 KB Output is correct
4 Correct 12 ms 940 KB Output is correct
5 Correct 5 ms 684 KB Output is correct
6 Correct 6 ms 724 KB Output is correct
7 Correct 11 ms 928 KB Output is correct
8 Correct 12 ms 900 KB Output is correct
9 Correct 8 ms 724 KB Output is correct
10 Correct 8 ms 672 KB Output is correct
11 Correct 12 ms 972 KB Output is correct
12 Correct 12 ms 964 KB Output is correct
13 Correct 6 ms 724 KB Output is correct
14 Correct 5 ms 724 KB Output is correct
15 Correct 10 ms 812 KB Output is correct
16 Correct 9 ms 752 KB Output is correct
17 Correct 10 ms 912 KB Output is correct
18 Correct 12 ms 840 KB Output is correct
19 Correct 16 ms 916 KB Output is correct
20 Correct 13 ms 800 KB Output is correct