Submission #655257

# Submission time Handle Problem Language Result Execution time Memory
655257 2022-11-03T15:55:11 Z Trumling Rice Hub (IOI11_ricehub) C++17
68 / 100
1000 ms 1100 KB
#include "ricehub.h"
#include<iostream>
#include<cmath>
using namespace std;
 
typedef long long ll;
#define pb push_back
#define F first
#define S second
#define enter cout<<'\n';
 
int besthub(int R, int L, int X[], long long B)
{
ll ans=1;
ll plus=R;
while(plus!=1)
{
if(ans!=1)
break;
bool pre=false;
ll curr=0;

for(int i=0;i<=R-plus;i++)
{
ll med;
if(!pre)
{
med=(i+i+plus-1)/2;
for(int j=i;j<i+plus;j++)
    curr+=abs(X[med]-X[j]);
 
pre=true;
}
else
{
    med++;
    ll dif=abs(X[med]-X[med-1]);
    curr+=abs(i-med)*dif;
    curr-=(plus-abs(i-med-1))*dif;
    curr+=abs(X[med]-X[i+plus-1]);
    curr-=abs(X[med-1]-X[i-1]);
   
}

 
 
 
 
if(curr<=B)
{
    ans=plus;
    break;
}
}
plus--;
}
//cout<<'\n'<<ans<<'\n';
return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 240 KB Output is correct
5 Correct 1 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 312 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 320 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 308 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
8 Correct 1 ms 316 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 1 ms 312 KB Output is correct
13 Correct 0 ms 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 0 ms 212 KB Output is correct
16 Correct 1 ms 212 KB Output is correct
17 Correct 1 ms 312 KB Output is correct
18 Correct 0 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 212 KB Output is correct
22 Correct 1 ms 212 KB Output is correct
23 Correct 0 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 316 KB Output is correct
28 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 316 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 3 ms 212 KB Output is correct
8 Correct 3 ms 320 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 212 KB Output is correct
11 Correct 2 ms 212 KB Output is correct
12 Correct 3 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 1 ms 212 KB Output is correct
17 Correct 1 ms 312 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 61 ms 340 KB Output is correct
22 Correct 57 ms 340 KB Output is correct
23 Correct 1 ms 340 KB Output is correct
24 Correct 1 ms 324 KB Output is correct
25 Correct 1 ms 340 KB Output is correct
26 Correct 1 ms 324 KB Output is correct
27 Correct 15 ms 324 KB Output is correct
28 Correct 15 ms 364 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 963 ms 508 KB Output is correct
2 Correct 986 ms 500 KB Output is correct
3 Correct 12 ms 1100 KB Output is correct
4 Correct 12 ms 1088 KB Output is correct
5 Execution timed out 1080 ms 720 KB Time limit exceeded
6 Halted 0 ms 0 KB -