Submission #655230

# Submission time Handle Problem Language Result Execution time Memory
655230 2022-11-03T14:59:22 Z Trumling Rice Hub (IOI11_ricehub) C++14
0 / 100
1000 ms 1740 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;
//cout<<'\n';
for(int i=0;i<=R-plus;i++)
{
ll med;
if(!pre)
{
med=(i+i+plus)/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-med)*dif;
    curr+=abs(X[med]-X[i+plus-1]);
    curr-=abs(X[med-1]-X[i-1]);
}

//cout<<curr<<' ';



if(curr<=B)
{
    ans=plus;
    break;
}
}
plus--;
}
//cout<<'\n'<<ans<<'\n';
return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 212 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 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 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 1 ms 312 KB Output is correct
11 Correct 0 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 0 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 Incorrect 1 ms 212 KB Output isn't correct
20 Halted 0 ms 0 KB -
# 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 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
6 Correct 1 ms 212 KB Output is correct
7 Correct 4 ms 320 KB Output is correct
8 Correct 2 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 2 ms 212 KB Output is correct
13 Correct 0 ms 312 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Incorrect 1 ms 212 KB Output isn't correct
16 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 879 ms 364 KB Output is correct
2 Correct 869 ms 500 KB Output is correct
3 Correct 10 ms 1740 KB Output is correct
4 Correct 11 ms 1708 KB Output is correct
5 Execution timed out 1090 ms 836 KB Time limit exceeded
6 Halted 0 ms 0 KB -