# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
732098 | Trunkty | Global Warming (NOI13_gw) | C++14 | 212 ms | 22540 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/extc++.h>
using namespace std;
typedef long long ll;
//#define int ll
int n,curr,ans;
int arr[1000005];
vector<pair<int,int>> v;
bool check[1000005];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cin >> n;
for(int i=1;i<=n;i++){
cin >> arr[i];
v.push_back({arr[i],i});
}
sort(v.begin(),v.end(),greater<pair<int,int>>());
for(int i=0;i<v.size();i++){
int x = v[i].second;
check[x] = true;
curr++;
if(check[x-1]){
curr--;
}
if(check[x+1]){
curr--;
}
if(i==v.size()-1 or v[i+1].first!=v[i].first){
ans = max(ans,curr);
}
}
cout << ans << "\n";
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... |