답안 #199801

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
199801 2020-02-03T13:05:42 Z aer0park 쌀 창고 (IOI11_ricehub) C++14
17 / 100
29 ms 1528 KB
#include "ricehub.h"
#include <bits/stdc++.h>
#define f first
#define s second
 
using namespace std;
 
typedef long long ll;
typedef pair<ll,ll> pi;
 
ll sum,anw,cnt=1;
queue<ll> st,ed;
 
int besthub(int r,int l,int x[],ll b)
{
	for(int i=r;i>=1;i--)
		x[i]=x[i-1];
	x[r+1]=l+1;
	for(int i=1;i<=r;i++)
	{
		sum+=(st.size()-ed.size())*(x[i]-x[i-1]);
		if(!ed.empty()) st.push(ed.front()),ed.pop();
		else st.push(cnt),cnt++;
		if(sum<=b) anw=max(anw,(ll)st.size()+(ll)ed.size());
		while(st.size()>=2&&(sum>b))
			sum-=x[i]-x[st.front()],st.pop();
		while(cnt<=r&&sum+x[cnt]-x[i]<=b)
			ed.push(cnt),sum+=x[cnt]-x[i],cnt++;
		anw=max(anw,(ll)st.size()+(ll)ed.size());
	}
	return anw;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 256 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 256 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 5 ms 256 KB Output is correct
10 Correct 5 ms 256 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 256 KB Output is correct
14 Incorrect 5 ms 256 KB Output isn't correct
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 256 KB Output is correct
3 Correct 5 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 5 ms 376 KB Output is correct
6 Correct 5 ms 376 KB Output is correct
7 Correct 5 ms 376 KB Output is correct
8 Correct 5 ms 376 KB Output is correct
9 Correct 5 ms 376 KB Output is correct
10 Correct 5 ms 376 KB Output is correct
11 Correct 5 ms 376 KB Output is correct
12 Correct 5 ms 376 KB Output is correct
13 Correct 5 ms 376 KB Output is correct
14 Correct 5 ms 376 KB Output is correct
15 Incorrect 6 ms 376 KB Output isn't correct
16 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 376 KB Output is correct
2 Correct 8 ms 376 KB Output is correct
3 Correct 25 ms 1528 KB Output is correct
4 Correct 25 ms 1528 KB Output is correct
5 Correct 15 ms 504 KB Output is correct
6 Correct 13 ms 504 KB Output is correct
7 Correct 23 ms 1528 KB Output is correct
8 Correct 26 ms 1528 KB Output is correct
9 Correct 13 ms 504 KB Output is correct
10 Correct 13 ms 504 KB Output is correct
11 Correct 29 ms 1528 KB Output is correct
12 Correct 27 ms 1528 KB Output is correct
13 Incorrect 14 ms 504 KB Output isn't correct
14 Halted 0 ms 0 KB -