Submission #1091530

# Submission time Handle Problem Language Result Execution time Memory
1091530 2024-09-21T07:07:08 Z stdfloat Global Warming (CEOI18_glo) C++17
38 / 100
2000 ms 3160 KB
#include <bits/stdc++.h>
using namespace std;

using ll = long long;

#define all(v) (v).begin(), v.end()

int main() {
	ios::sync_with_stdio(false); cin.tie(nullptr);

	int n, x;
	cin >> n >> x;

	vector<int> a(n);
	for (auto &i : a)
		cin >> i;

	if (!x) {
		vector<int> v;
		for (int i = 0; i < n; i++) {
			if (v.empty() || v.back() < a[i]) v.push_back(a[i]);
			else v[lower_bound(all(v), a[i]) - v.begin()] = a[i];
		}

		return cout << (int)v.size(), 0;
	}

	int ans = 0;
	vector<int> v;
	for (int i = 0; i < n; i++) {
		vector<int> u = v;
		for (int j = i; j < n; j++) {
			a[j] += x;
			if (u.empty() || u.back() < a[j]) u.push_back(a[j]);
			else u[lower_bound(all(u), a[j]) - u.begin()] = a[j];
			a[j] -= x;
		}

		ans = max(ans, (int)u.size());

		if (v.empty() || v.back() < a[i]) v.push_back(a[i]);
		else v[lower_bound(all(v), a[i]) - v.begin()] = a[i];
	}

	cout << ans << '\n';
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 348 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 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 0 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 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 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 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 0 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 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 5 ms 348 KB Output is correct
20 Correct 5 ms 344 KB Output is correct
21 Correct 4 ms 472 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 4 ms 348 KB Output is correct
24 Correct 3 ms 348 KB Output is correct
25 Correct 2 ms 344 KB Output is correct
26 Correct 3 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 34 ms 3156 KB Output is correct
2 Correct 22 ms 3160 KB Output is correct
3 Correct 23 ms 3028 KB Output is correct
4 Correct 23 ms 3160 KB Output is correct
5 Correct 13 ms 3036 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 2054 ms 1136 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 2032 ms 1804 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 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 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 0 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 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 344 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 5 ms 348 KB Output is correct
20 Correct 5 ms 344 KB Output is correct
21 Correct 4 ms 472 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 4 ms 348 KB Output is correct
24 Correct 3 ms 348 KB Output is correct
25 Correct 2 ms 344 KB Output is correct
26 Correct 3 ms 348 KB Output is correct
27 Correct 34 ms 3156 KB Output is correct
28 Correct 22 ms 3160 KB Output is correct
29 Correct 23 ms 3028 KB Output is correct
30 Correct 23 ms 3160 KB Output is correct
31 Correct 13 ms 3036 KB Output is correct
32 Execution timed out 2054 ms 1136 KB Time limit exceeded
33 Halted 0 ms 0 KB -