| # | Time | Username | Problem | Language | Result | Execution time | Memory |
|---|---|---|---|---|---|---|---|
| 1353300 | putuputu | Global Warming (NOI13_gw) | C++20 | 267 ms | 12612 KiB |
#include<bits/stdc++.h>
using namespace std;
signed main(){
int n;
cin >> n;
int a[n];
for(int i=0; i<n; i++){
cin >> a[i];
}
vector<pair<int, int>> p;
for(int i=0; i<n; i++){
p.push_back({a[i], i});
}
p.push_back({-1, n+1});
int ans=0, ans1=0;
sort(p.begin(), p.end());
reverse(p.begin(), p.end());
vector<bool> t(n+1, false);
for(int i=0; i<n; i++){
t[p[i].second]=true;
int cnt=0;
if(t[p[i].second+1]==true){
cnt++;
}
if(t[p[i].second-1]==true){
cnt++;
}
if(cnt==0){
ans++;
}
if(cnt==2){
ans--;
}
if(p[i].first!=p[i+1].first and p[i+1].first!=-1){
ans1=max(ans, ans1);
}
}
cout << ans1;
}| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Result | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
