Submission #633531

#TimeUsernameProblemLanguageResultExecution timeMemory
633531Ahmed57Global Warming (NOI13_gw)C++14
19 / 40
1035 ms65536 KiB
#include <bits/stdc++.h> using namespace std; long long n; int pre[3000001]; int main(){ ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0); cin>>n; vector<long long> v,w; v.push_back(2); map<int,int> sa,cmp; for(int i = 0;i<n;i++){ int x;cin>>x; w.push_back(x); sa[x]++; } int z = 2; for(auto i:sa){ cmp[i.first] = z++; } for(int i = 0;i<n;i++){ v.push_back(cmp[w[i]]*2); } for(int i = 0;i<n;i++){ if(v[i]<v[i+1]){ pre[v[i+1]]--; pre[v[i]]++; } } long long ma = 0 , cur = 0; for(int i = 2;i<(n+2)*2;i++){ cur+=pre[i]; ma = max(ma,cur); } cout<<ma<<"\n"; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...