Submission #224621

# Submission time Handle Problem Language Result Execution time Memory
224621 2020-04-18T14:00:58 Z DanerZein Rice Hub (IOI11_ricehub) C++14
0 / 100
1000 ms 784 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
int besthub(int R,int L,int X[], long long B){
  long long ma=-1;
  for(int i=0;i<R;i++){
    for(int j=i;j<R;j++){
      vector<int>rp;
      for(int k=i;k<=j;k++){
	rp.push_back(X[k]);
      }
      int mi=(i+j)/2;
      mi=X[mi];
      bool sw=0;
      long long b=B;
      for(int k=0;k<rp.size();k++){
	if(b<=0){
	  sw=1;
	  break;
	}
	b-=abs(X[mi]-rp[k]);
	//c++;
      }
      if(sw==1){
	long long tam=rp.size();
	ma=max(ma,tam);
      }
    }
  }
  return ma;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:16:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
       for(int k=0;k<rp.size();k++){
                   ~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 11 ms 256 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1078 ms 784 KB Time limit exceeded
2 Halted 0 ms 0 KB -