Submission #971722

# Submission time Handle Problem Language Result Execution time Memory
971722 2024-04-29T08:16:41 Z batsukh2006 Rice Hub (IOI11_ricehub) C++17
68 / 100
142 ms 3712 KB
#include<bits/stdc++.h>
//#include "ricehub"
using namespace std;
#define ss second
#define ff first
#define endl '\n'
int besthub(int r, int l, int x[], long long B){
	int ans=0;
	for(int i=0; i<r; i++){
		int b=B;
		int sum=1;
		int lt=i-1,rt=i+1;
		while(lt>=0||rt<r){
			if(lt>=0&&(abs(x[i]-x[lt])<=abs(x[i]-x[rt])||rt==r)){
				if(abs(x[i]-x[lt])>b) break;
				sum++;
				b-=abs(x[i]-x[lt--]);
			}else{
				if(abs(x[i]-x[rt])>b) break;
				sum++;
				b-=abs(x[i]-x[rt++]);
			}
		}
		ans=max(ans,sum);
	}
	return ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 444 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory 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 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 344 KB Output is correct
7 Correct 1 ms 348 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 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 1 ms 348 KB Output is correct
15 Correct 0 ms 452 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 1 ms 348 KB Output is correct
24 Correct 1 ms 348 KB Output is correct
25 Correct 1 ms 348 KB Output is correct
26 Correct 1 ms 348 KB Output is correct
27 Correct 1 ms 344 KB Output is correct
28 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 2 ms 348 KB Output is correct
4 Correct 2 ms 600 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 1 ms 344 KB Output is correct
13 Correct 2 ms 348 KB Output is correct
14 Correct 2 ms 348 KB Output is correct
15 Correct 1 ms 344 KB Output is correct
16 Correct 1 ms 348 KB Output is correct
17 Correct 3 ms 456 KB Output is correct
18 Correct 3 ms 348 KB Output is correct
19 Correct 4 ms 348 KB Output is correct
20 Correct 5 ms 348 KB Output is correct
21 Correct 3 ms 348 KB Output is correct
22 Correct 3 ms 344 KB Output is correct
23 Correct 51 ms 344 KB Output is correct
24 Correct 52 ms 348 KB Output is correct
25 Correct 98 ms 344 KB Output is correct
26 Correct 109 ms 348 KB Output is correct
27 Correct 28 ms 348 KB Output is correct
28 Correct 28 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 652 KB Output is correct
2 Correct 5 ms 604 KB Output is correct
3 Incorrect 142 ms 3712 KB Output isn't correct
4 Halted 0 ms 0 KB -