# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
924655 | sleepntsheep | Global Warming (NOI13_gw) | C++17 | 195 ms | 20940 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;
#define N 1000005
int n, f[N], z;
pair<int, int> a[N];
int main()
{
scanf("%d", &n);
for (int i = 0; i < n; i++) scanf("%d", &a[i].first), a[i].second = i + 2;
sort(a, a+n);
for (int distinct = 0, i = n; i--;)
{
int x = a[i].second;
if (!f[x-1] && !f[x+1])
distinct++;
else if (f[x-1] ^ f[x+1])
;
else
distinct--;
f[x] = 1;
z = max(z, distinct);
}
printf("%d\n", z);
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... |