#include <bits/stdc++.h>
using namespace std;
long long n;
int pre[2000005];
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<long long,long long> sa,cmp;
for(int i = 0;i<n;i++){
long long x;cin>>x;
w.push_back(x);
sa[x]++;
}
long long 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+1)*2;i++){
cur+=pre[i];
ma = max(ma,cur);
}
cout<<ma<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
468 KB |
Output is correct |
2 |
Correct |
1 ms |
468 KB |
Output is correct |
3 |
Correct |
1 ms |
468 KB |
Output is correct |
4 |
Correct |
1 ms |
468 KB |
Output is correct |
5 |
Correct |
1 ms |
468 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
2640 KB |
Output is correct |
2 |
Correct |
12 ms |
2640 KB |
Output is correct |
3 |
Correct |
13 ms |
2660 KB |
Output is correct |
4 |
Correct |
12 ms |
2644 KB |
Output is correct |
5 |
Correct |
14 ms |
2644 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
113 ms |
15220 KB |
Output is correct |
2 |
Correct |
70 ms |
15372 KB |
Output is correct |
3 |
Correct |
104 ms |
15256 KB |
Output is correct |
4 |
Correct |
104 ms |
15376 KB |
Output is correct |
5 |
Correct |
103 ms |
15312 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
831 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
938 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |