Submission #655232

# Submission time Handle Problem Language Result Execution time Memory
655232 2022-11-03T14:59:50 Z Dremix10 Rice Hub (IOI11_ricehub) C++17
42 / 100
1000 ms 340 KB
#include<bits/stdc++.h>
#include "ricehub.h"
int besthub(int R, int L, int X[], long long B)
{
    int p=0,k=1,result;
   for(int i=R;i>=0;i--)
   {
       for(int j=0;j<=R-i;j++)
       {
           int t=j+i;
           int mid=X[(t-1+j)/2];
           int countt=0;
           for(int o=j;o<t;o++)
               countt+=abs(mid-X[o]);
           if(countt<=B){
                result=i;
                k=0;
                break;
           }
       }
       if(k==0)break;
   }
  return result;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:5:9: warning: unused variable 'p' [-Wunused-variable]
    5 |     int p=0,k=1,result;
      |         ^
ricehub.cpp:23:10: warning: 'result' may be used uninitialized in this function [-Wmaybe-uninitialized]
   23 |   return result;
      |          ^~~~~~
# 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
# Verdict Execution time Memory Grader output
1 Correct 1 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 0 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 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 0 ms 212 KB Output is correct
11 Correct 1 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 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 1 ms 212 KB Output is correct
17 Correct 0 ms 212 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 312 KB Output is correct
21 Correct 18 ms 308 KB Output is correct
22 Correct 18 ms 340 KB Output is correct
23 Correct 2 ms 212 KB Output is correct
24 Correct 1 ms 312 KB Output is correct
25 Correct 2 ms 212 KB Output is correct
26 Correct 2 ms 212 KB Output is correct
27 Correct 12 ms 212 KB Output is correct
28 Correct 12 ms 308 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 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 18 ms 212 KB Output is correct
6 Correct 18 ms 308 KB Output is correct
7 Correct 139 ms 292 KB Output is correct
8 Correct 135 ms 292 KB Output is correct
9 Correct 17 ms 300 KB Output is correct
10 Correct 17 ms 312 KB Output is correct
11 Correct 69 ms 292 KB Output is correct
12 Correct 74 ms 216 KB Output is correct
13 Correct 1 ms 212 KB Output is correct
14 Correct 1 ms 212 KB Output is correct
15 Correct 13 ms 304 KB Output is correct
16 Correct 12 ms 308 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 0 ms 212 KB Output is correct
21 Execution timed out 1086 ms 340 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1095 ms 340 KB Time limit exceeded
2 Halted 0 ms 0 KB -