Submission #552412

# Submission time Handle Problem Language Result Execution time Memory
552412 2022-04-23T06:22:40 Z Wasrek Rice Hub (IOI11_ricehub) C++14
100 / 100
15 ms 1736 KB
#include<bits/stdc++.h>
//#include "grader.cpp"
#include "ricehub.h"
using namespace std;
int besthub(int R, int L, int X[], long long B)
{
  long long now=0,temp;
  int ans=0;
  for(int i=0, j=0;i<R && j<R;i++){
    if(j<i)j=i,now=0;
    while(j<(R-1)){//move j
      temp=(X[j+1]-X[(i+j+1)>>1]);
      if(now+temp<=B) j++,now+=temp;
      else break;
    }
    // printf("%d %d %d\n",i,j,now);
    ans=max(ans,j-i+1);
    if(j==R-1) break;
    now-=X[(i+j+1)>>1]-X[i];
  }                        
  return ans;
}
# Verdict Execution time Memory 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
# Verdict Execution time Memory 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 0 ms 212 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 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 212 KB Output is correct
16 Correct 0 ms 212 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 0 ms 212 KB Output is correct
19 Correct 0 ms 212 KB Output is correct
20 Correct 1 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 0 ms 212 KB Output is correct
23 Correct 0 ms 212 KB Output is correct
24 Correct 0 ms 212 KB Output is correct
25 Correct 0 ms 212 KB Output is correct
26 Correct 0 ms 212 KB Output is correct
27 Correct 0 ms 212 KB Output is correct
28 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory 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 0 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 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 1 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 0 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 0 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 0 ms 212 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 1 ms 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 1 ms 212 KB Output is correct
25 Correct 1 ms 212 KB Output is correct
26 Correct 1 ms 212 KB Output is correct
27 Correct 1 ms 328 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 2 ms 340 KB Output is correct
3 Correct 10 ms 608 KB Output is correct
4 Correct 10 ms 596 KB Output is correct
5 Correct 5 ms 852 KB Output is correct
6 Correct 5 ms 832 KB Output is correct
7 Correct 10 ms 1448 KB Output is correct
8 Correct 10 ms 1384 KB Output is correct
9 Correct 5 ms 744 KB Output is correct
10 Correct 5 ms 664 KB Output is correct
11 Correct 11 ms 1736 KB Output is correct
12 Correct 15 ms 1732 KB Output is correct
13 Correct 7 ms 836 KB Output is correct
14 Correct 6 ms 852 KB Output is correct
15 Correct 9 ms 1364 KB Output is correct
16 Correct 9 ms 1364 KB Output is correct
17 Correct 10 ms 1608 KB Output is correct
18 Correct 10 ms 1484 KB Output is correct
19 Correct 11 ms 1608 KB Output is correct
20 Correct 11 ms 1580 KB Output is correct