Submission #468026

# Submission time Handle Problem Language Result Execution time Memory
468026 2021-08-25T22:46:16 Z rc_catunta Rice Hub (IOI11_ricehub) C++14
42 / 100
1000 ms 460 KB
#include "ricehub.h"
#include <iostream>
#include <cmath>
using namespace std;

int besthub(int R, int L, int X[], long long B)
{
  for(int s=R;s>=1;s--){ // Recorre los tamaños
    for(int i=0;i<=R-s;i++){ // Generamos el rango
      int a = i;
      int b = i+s-1;
      int m = (a+b)/2;
      long long sum = 0LL;
      for(int j=i;j<i+s;j++){ // Recorremos el rango
        long long dif = abs(X[j]-X[m]);
        sum+=dif;
      }
      if(sum<=B){
        return s;
      }
    }

  }
  return 1;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 308 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 308 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 ms 204 KB Output is correct
9 Correct 0 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 0 ms 204 KB Output is correct
12 Correct 0 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 0 ms 300 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 22 ms 300 KB Output is correct
22 Correct 22 ms 304 KB Output is correct
23 Correct 2 ms 204 KB Output is correct
24 Correct 2 ms 204 KB Output is correct
25 Correct 2 ms 204 KB Output is correct
26 Correct 2 ms 204 KB Output is correct
27 Correct 12 ms 300 KB Output is correct
28 Correct 17 ms 304 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 23 ms 308 KB Output is correct
6 Correct 23 ms 204 KB Output is correct
7 Correct 174 ms 296 KB Output is correct
8 Correct 175 ms 308 KB Output is correct
9 Correct 23 ms 324 KB Output is correct
10 Correct 29 ms 204 KB Output is correct
11 Correct 87 ms 204 KB Output is correct
12 Correct 90 ms 304 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 15 ms 300 KB Output is correct
16 Correct 15 ms 304 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Execution timed out 1092 ms 332 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 460 KB Time limit exceeded
2 Halted 0 ms 0 KB -