Submission #444519

# Submission time Handle Problem Language Result Execution time Memory
444519 2021-07-14T08:10:29 Z fuad27 Global Warming (CEOI18_glo) C++14
25 / 100
2000 ms 3624 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long
int CeilIndex(vector<int>& v, int l, int r, int key)
{
	while (r - l > 1) {
		int m = l + (r - l) / 2;
		if (v[m] >= key)
			r = m;
		else
			l = m;
	}
 
	return r;
}
 
int lis(vector<int>& v)
{
	if (v.size() == 0)
		return 0;
	vector<int> tail(v.size(), 0);
	int length = 1; 
	tail[0] = v[0];
	for (size_t i = 1; i < v.size(); i++) {
 
		if (v[i] < tail[0])
			tail[0] = v[i];
		else if (v[i] > tail[length - 1])
			tail[length++] = v[i];
		else
			tail[CeilIndex(tail, -1, length - 1, v[i])] = v[i];
	}
 
	return length;
}
 
int32_t main()
{	
	int n, x;
	cin >> n >> x;
	vector<int> v;
	for(int i = 0;i<n;i++) {
		int p;
		cin >> p;
		v.push_back(p);
	}
	int MAX = lis(v);
	if(x!=0) {
	for(int i = 0;i<n;i++) {
		for(int j = i;j<n;j++) {
			for(int d = -x;d<=x;d++) {
				for(int k = i;k<j;k++) {
					v[k] += d;
				}
				MAX = max(MAX, lis(v));
				for(int k = i;k<j;k++)v[k]-=d;
			}
		}
	}
	}
	cout<<MAX<<endl;
	return 0;
}
# 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 0 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 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 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
# 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 0 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 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 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 25 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 85 ms 268 KB Output is correct
15 Correct 21 ms 288 KB Output is correct
16 Correct 48 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 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 0 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 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 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 25 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 85 ms 268 KB Output is correct
15 Correct 21 ms 288 KB Output is correct
16 Correct 48 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 Execution timed out 2058 ms 204 KB Time limit exceeded
20 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 104 ms 3512 KB Output is correct
2 Correct 100 ms 3596 KB Output is correct
3 Correct 173 ms 3624 KB Output is correct
4 Correct 96 ms 3580 KB Output is correct
5 Correct 78 ms 3568 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2096 ms 1208 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2076 ms 1860 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 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 0 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 0 ms 204 KB Output is correct
7 Correct 0 ms 204 KB Output is correct
8 Correct 0 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 25 ms 204 KB Output is correct
13 Correct 0 ms 204 KB Output is correct
14 Correct 85 ms 268 KB Output is correct
15 Correct 21 ms 288 KB Output is correct
16 Correct 48 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 Execution timed out 2058 ms 204 KB Time limit exceeded
20 Halted 0 ms 0 KB -