Submission #411559

# Submission time Handle Problem Language Result Execution time Memory
411559 2021-05-25T13:51:29 Z jeqcho Rice Hub (IOI11_ricehub) C++17
42 / 100
1000 ms 352 KB
#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pair<int,int>> vpi;

#define FOR(i,a,b) for (int i = (a); i < (b); ++i)
#define F0R(i,a) FOR(i,0,a)
#define ROF(i,a,b) for (int i = (b)-1; i >= (a); --i)
#define R0F(i,a) ROF(i,0,a)
#define trav(a,x) for (auto& a: x)

#define pb push_back
#define rsz resize
#define sz(x) int(x.size())
#define all(x) begin(x), end(x)
#define fi first

// subtask 1,2,3

int besthub(int R, int L, int X[], ll B){
	int mx=0;
	FOR(len,1,R+1)
	{
		F0R(i,R)
		{
			int las = i+len-1;
			if(las>=R)break;
			int mid = (i+las)/2;
			ll cur=0;
			FOR(j,i,las+1)
			{
				cur += (ll)abs(X[j]-X[mid]);
			}
			if(cur<=B)
			{
				mx=max(mx,len);
			}
		}
	}
	return mx;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
6 Correct 1 ms 308 KB Output is correct
7 Correct 1 ms 204 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 1 ms 204 KB Output is correct
12 Correct 1 ms 204 KB Output is correct
13 Correct 1 ms 204 KB Output is correct
14 Correct 1 ms 204 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 1 ms 204 KB Output is correct
21 Correct 22 ms 300 KB Output is correct
22 Correct 22 ms 204 KB Output is correct
23 Correct 22 ms 352 KB Output is correct
24 Correct 22 ms 280 KB Output is correct
25 Correct 22 ms 204 KB Output is correct
26 Correct 22 ms 300 KB Output is correct
27 Correct 23 ms 300 KB Output is correct
28 Correct 22 ms 308 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 204 KB Output is correct
2 Correct 2 ms 204 KB Output is correct
3 Correct 121 ms 204 KB Output is correct
4 Correct 122 ms 204 KB Output is correct
5 Correct 21 ms 204 KB Output is correct
6 Correct 22 ms 204 KB Output is correct
7 Correct 189 ms 292 KB Output is correct
8 Correct 163 ms 204 KB Output is correct
9 Correct 22 ms 204 KB Output is correct
10 Correct 22 ms 204 KB Output is correct
11 Correct 88 ms 204 KB Output is correct
12 Correct 95 ms 204 KB Output is correct
13 Correct 173 ms 292 KB Output is correct
14 Correct 163 ms 324 KB Output is correct
15 Correct 24 ms 204 KB Output is correct
16 Correct 24 ms 304 KB Output is correct
17 Correct 89 ms 288 KB Output is correct
18 Correct 84 ms 308 KB Output is correct
19 Correct 166 ms 204 KB Output is correct
20 Correct 161 ms 204 KB Output is correct
21 Execution timed out 1087 ms 332 KB Time limit exceeded
22 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1084 ms 332 KB Time limit exceeded
2 Halted 0 ms 0 KB -