# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
714824 | BidoTeima | Global Warming (NOI13_gw) | C++17 | 1068 ms | 65536 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.
/*
ID: BidoTeima
LANG: C++11
TASK:
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
void moo(string filename);
void ACPLS(string str = "")
{
if(str=="NOF")return;
if(str.size() && str != "IIOT")
moo(str);
else if(str != "IIOT"){
#ifndef ONLINE_JUDGE
freopen("output.txt", "w", stdout);
freopen("input.txt", "r", stdin);
#endif
}
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
}
void moo(string fileName){
freopen((fileName+".in").c_str(),"r",stdin);
freopen((fileName+".out").c_str(),"w",stdout);
}
#define tcccc \
int tttttt/*,subtask*/; \
cin >> tttttt/* >> subtask*/; \
while (tttttt--)/*end
*/
int main()
{
//ACPLS("");
int n;
cin>>n;
n += 2;
int a[n], cur = 1;
a[0] = 0;
for(int i = 1; i < n - 1; i++){
cin>>a[i];
}
a[n - 1] = 0;
vector<int>c;
for(int i = 0; i < n; i++){
if(i && a[i] == a[i - 1])continue;
c.push_back(a[i]);
}
n = (int)c.size();
map<int,vector<int>>mp{};
for(int i = 0; i < n; i++){
mp[c[i]].push_back(i);
}
int ans = 1;
for(auto&it:mp){
int x = it.first;
if(!x)continue;
vector<int>&v = it.second;
for(int i = 0; i < (int)v.size(); i++){
assert(v[i] - 1 >= 0);
assert(v[i] + 1 < n);
int val = (c[v[i] - 1] < x) + (c[v[i] + 1] < x);
if(val == 0){
cur++;
}
else if(val == 2){
cur--;
}
}
ans = max(ans, cur);
}
cout<<ans<<'\n';
}
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... |