Submission #633579

# Submission time Handle Problem Language Result Execution time Memory
633579 2022-08-22T18:46:46 Z Ahmed57 Global Warming (NOI13_gw) C++14
19 / 40
1000 ms 49128 KB
#include <bits/stdc++.h>

using namespace std;
int n;
int pre[2000005];
map<int,int> cmp;
int main(){
    cin>>n;
    int la = 2;
    set<int> s;
    int arr[n];
    for(int i = 0;i<n;i++){
        cin>>arr[i];
        s.insert(arr[i]);
    }
    long long z = 1;
    for(auto i:s){
        cmp[i] = ++z;
    }
    for(int i = 0;i<n;i++){
        if(la<cmp[arr[i]]*2){
            pre[la]++;
            pre[cmp[arr[i]]*2]--;
        }
        la = cmp[arr[i]]*2;
    }
    int ma = 0;la = 0;
    for(int i = 2;i<=z*2;i++){
        la+=pre[i];
        ma = max(ma,la);
    }
    cout<<ma<<"\n";
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 21 ms 688 KB Output is correct
2 Correct 21 ms 596 KB Output is correct
3 Correct 21 ms 596 KB Output is correct
4 Correct 21 ms 596 KB Output is correct
5 Correct 21 ms 692 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 137 ms 10772 KB Output is correct
2 Correct 97 ms 10768 KB Output is correct
3 Correct 133 ms 10812 KB Output is correct
4 Correct 135 ms 10836 KB Output is correct
5 Correct 125 ms 10780 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 1088 ms 49128 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1086 ms 47484 KB Time limit exceeded
2 Halted 0 ms 0 KB -