답안 #953902

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
953902 2024-03-26T20:27:01 Z 4QT0R 쌀 창고 (IOI11_ricehub) C++17
49 / 100
10 ms 2804 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long

ll besthub(int n, int L, int pos[], ll bud){
	ll l,p,sm;
	l=p=sm=0;
	while(p<n-1 && sm+pos[p+1]-pos[0]<=bud){
		p++;
		sm+=pos[p]-pos[0];
	}
	ll mx=p+1;
	for (ll i = 1; i<n; i++){
		sm+=(ll)(pos[i]-pos[i-1])*(i-l);
		sm-=(ll)(pos[i]-pos[i-1])*(p-i+1);
		while(sm>bud && l<i){
			sm-=pos[i]-pos[l];
			l++;
		}
		while(p<n-1 && sm+pos[p+1]-pos[i]<=bud){
			p++;
			sm+=pos[p]-pos[i];
		}
		mx=max(mx,p-l+1);
		while(l<i && p<n-1 && (pos[p+1]-pos[i])<(pos[i]-pos[l])){
			sm-=pos[i]-pos[l];
			l++;
			while(p<n-1 && sm+pos[p+1]-pos[i]<=bud){
				p++;
				sm+=pos[p]-pos[i];
			}
			mx=max(mx,p-l+1);
		}
		mx=max(mx,p-l+1);
	}
	return mx;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Correct 1 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 344 KB Output is correct
19 Correct 1 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 0 ms 348 KB Output is correct
22 Correct 0 ms 348 KB Output is correct
23 Correct 0 ms 348 KB Output is correct
24 Correct 0 ms 348 KB Output is correct
25 Correct 0 ms 348 KB Output is correct
26 Correct 0 ms 344 KB Output is correct
27 Incorrect 0 ms 344 KB Output isn't correct
28 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 0 ms 348 KB Output is correct
14 Correct 0 ms 348 KB Output is correct
15 Correct 0 ms 348 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Incorrect 0 ms 348 KB Output isn't correct
19 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 600 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 9 ms 2804 KB Output is correct
4 Correct 10 ms 2564 KB Output is correct
5 Correct 4 ms 2652 KB Output is correct
6 Correct 4 ms 2652 KB Output is correct
7 Correct 9 ms 2652 KB Output is correct
8 Correct 9 ms 2512 KB Output is correct
9 Correct 5 ms 2652 KB Output is correct
10 Correct 5 ms 2648 KB Output is correct
11 Correct 10 ms 2652 KB Output is correct
12 Correct 10 ms 2652 KB Output is correct
13 Correct 5 ms 2652 KB Output is correct
14 Correct 5 ms 2636 KB Output is correct
15 Correct 7 ms 2652 KB Output is correct
16 Correct 8 ms 2652 KB Output is correct
17 Correct 8 ms 2672 KB Output is correct
18 Correct 10 ms 2648 KB Output is correct
19 Correct 9 ms 2636 KB Output is correct
20 Correct 9 ms 2652 KB Output is correct