Submission #635412

#TimeUsernameProblemLanguageResultExecution timeMemory
635412FulopMateGlobal Warming (CEOI18_glo)C++17
Compilation error
0 ms0 KiB
#include <algorithm>
#include <vector>
using namespace std;
const int maxn = 200010;
 
int t[maxn], _end[maxn];
int dp[maxn];
 
int main()
{
	int n, x;
	cin >> n >> x;
	for (int i = 1; i <= n; i++) cin >> t[i];
	fill(dp, dp + n + 2, INT32_MAX);
	dp[0] = INT32_MIN;
	for (int i = 1; i <= n; i++) {
		int j = upper_bound(dp, dp + n + 1, t[i]) - dp;
		if (dp[j - 1] < t[i] && t[i] < dp[j]) {
			dp[j] = t[i];
			//_end[i] = j;
		}
		else {
			//_end[i] = j - 1;
		}
	}
	/*fill(dp, dp + n + 2, INT32_MIN);
	dp[0] = INT32_MAX;
	int ans = 0;
	for (int i = n; i > 0; i--) {
		int l = 0, r = n + 1;
		while (l + 1 < r) {
			int m = (l + r) / 2;
			if (dp[m] > t[i] - x)l = m;
			else r = m;
		}
		ans = max(ans, _end[i] + l);
 
		l = 0, r = n + 1;
		while (l + 1 < r) {
			int m = (l + r) / 2;
			if (dp[m] > t[i])l = m;
			else r = m;
		}
		dp[l + 1] = t[i];
	}
	cout << ans << endl;*/
}

Compilation message (stderr)

glo.cpp: In function 'int main()':
glo.cpp:12:2: error: 'cin' was not declared in this scope
   12 |  cin >> n >> x;
      |  ^~~
glo.cpp:2:1: note: 'std::cin' is defined in header '<iostream>'; did you forget to '#include <iostream>'?
    1 | #include <algorithm>
  +++ |+#include <iostream>
    2 | #include <vector>
glo.cpp:14:23: error: 'INT32_MAX' was not declared in this scope
   14 |  fill(dp, dp + n + 2, INT32_MAX);
      |                       ^~~~~~~~~
glo.cpp:15:10: error: 'INT32_MIN' was not declared in this scope
   15 |  dp[0] = INT32_MIN;
      |          ^~~~~~~~~