답안 #110684

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
110684 2019-05-11T23:19:23 Z ioilolcom 쌀 창고 (IOI11_ricehub) C++14
0 / 100
1000 ms 3292 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 ;
	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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 256 KB Output is correct
2 Incorrect 2 ms 384 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 256 KB Output is correct
2 Correct 2 ms 256 KB Output is correct
3 Incorrect 2 ms 384 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 82 ms 952 KB Output is correct
2 Correct 86 ms 956 KB Output is correct
3 Execution timed out 1067 ms 3292 KB Time limit exceeded
4 Halted 0 ms 0 KB -