Submission #110409

# Submission time Handle Problem Language Result Execution time Memory
110409 2019-05-10T19:25:40 Z ioilolcom Rice Hub (IOI11_ricehub) C++14
0 / 100
1000 ms 3320 KB
#include <bits/stdc++.h>
#include "ricehub.h"
using namespace std;
#define endl "\n"
#define x first
#define y second
#define pii pair<int,int>
typedef long long int ll;




vector<int> v;
int besthub(int R, int L, int X[], long long B)
{
	int n=R;
	ll w=B;
	v.resize(n+1);
	for(int i=0; i<n; i++) {
		v[i+1]=X[i];
	}
	int idx=n/2 +(n%2);
	vector<pii> l,r;
	int cur=0;
	int curv=0;
	for(int i=idx+1; i<=n; i++) {
		curv+=v[i]-v[idx];
		cur++;
		r.push_back({curv,cur});
	}
	r.push_back({0,0});
	l.push_back({0,0});
	cur=0;
	curv=0;
	for(int i=idx-1; i>=0; i--) {
		curv+=abs(v[i]-v[idx]);
		cur++;
		l.push_back({curv,cur});
	}
	int ans=0;
	for(pii u:l) {
		for(pii v:r) {
			if(u.x+v.x<=w) {
				ans=max(ans,u.y+v.y);
			}
		}
	}
	ans++;

	return ans;
}

# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Incorrect 5 ms 256 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Incorrect 3 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 95 ms 896 KB Output is correct
2 Correct 105 ms 956 KB Output is correct
3 Execution timed out 1066 ms 3320 KB Time limit exceeded
4 Halted 0 ms 0 KB -