Submission #133001

# Submission time Handle Problem Language Result Execution time Memory
133001 2019-07-20T03:59:29 Z Boxworld Rice Hub (IOI11_ricehub) C++14
0 / 100
499 ms 54828 KB
#include "ricehub.h"
#include <bits/stdc++.h>
using namespace std;
const int maxN=100100;
long long S[maxN];
int besthub(int R, int L, int X[], long long B){
	for (int i=0;i<R;i++)S[i]=S[i-1]+X[i];
	int l,r,ans=1;
	for (int l=0;l<R;l++)
	for (int r=l;r<R;r++){
		int m=(l+r)/2,nL=l-1;
		long long cost=S[m]-S[l-1]-(m-l+1)*X[l]+S[r]-S[m]-(r-m)*X[m];
		printf("l=%d r=%d m=%d cost=%lld\n",l,r,m,cost);
		if(cost<=B)ans=max(ans,r-l+1);
		else break;
	}
	return ans;
}

Compilation message

ricehub.cpp: In function 'int besthub(int, int, int*, long long int)':
ricehub.cpp:11:17: warning: unused variable 'nL' [-Wunused-variable]
   int m=(l+r)/2,nL=l-1;
                 ^~
ricehub.cpp:8:6: warning: unused variable 'l' [-Wunused-variable]
  int l,r,ans=1;
      ^
ricehub.cpp:8:8: warning: unused variable 'r' [-Wunused-variable]
  int l,r,ans=1;
        ^
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 504 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 376 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 499 ms 54828 KB Output isn't correct
2 Halted 0 ms 0 KB -