# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
889423 | htphong0909 | Global Warming (NOI13_gw) | C++17 | 250 ms | 17144 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include<bits/stdc++.h>
using namespace std;
void File() {
#define file "test"
freopen(file".in", "r", stdin);
freopen(file".out", "w", stdout);
}
int arr[1000001];
int32_t main()
{
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
vector <int> ed;
//File();
int n;
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> arr[i];
if (i > 1) ed.emplace_back(min(arr[i], arr[i - 1]));
}
sort(arr + 1, arr + 1 + n);
sort(ed.begin(), ed.end());
int p = 0;
int ans = 0;
for (int i = 0; i < n - 1; i++)
{
while (p + 1 < n && arr[p + 1] <= ed[i]) p++;
ans = max(ans, 2 + i - p);
}
cout << ans;
return 0;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |