# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
425444 | errorgorn | Global Warming (NOI13_gw) | C++17 | 354 ms | 18604 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 <cstdio>
#include <algorithm>
#include <utility>
#include <vector>
using namespace std;
typedef pair<int,int> ii;
vector<ii> v;
int n,t,islands,max_islands,pp=1;
bool arr[1000005];
int main(){
scanf("%d",&n);
for (int x=1;x<=n;x++){
scanf("%d",&t);
v.push_back(ii (-t,x));
}
sort(v.begin(),v.end());
for (vector<ii>::iterator it=v.begin();it!=v.end();it++){
if ((*it).first!=pp){
pp=(*it).first;
max_islands=max(islands,max_islands);
}
t=(*it).second;
if (!(arr[t-1] || arr[t+1])){
islands++;
}
else if (arr[t-1] && arr[t+1]){
islands--;
}
arr[t]=true;
}
printf("%d\n",max(max_islands,islands));
}
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... |