Submission #633529

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

using namespace std;
long long n;
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;
    for(int i = 0;i<n;i++){
        int x;cin>>x;
        w.push_back(x);
        sa[x]++;
    }
    int z = 2;
    map<int,int>cmp;
    for(auto i:sa){
        cmp[i.first] = z++;
    }
    for(int i = 0;i<n;i++){
        v.push_back(cmp[w[i]]*2);
    }
    long long pre[(n+2)*2]={0};
    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 time Memory Grader output
1 Correct 1 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 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 13 ms 3584 KB Output is correct
2 Correct 13 ms 3536 KB Output is correct
3 Correct 12 ms 3536 KB Output is correct
4 Correct 13 ms 3536 KB Output is correct
5 Correct 12 ms 3536 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 100 ms 12876 KB Output is correct
2 Correct 62 ms 12948 KB Output is correct
3 Correct 89 ms 12864 KB Output is correct
4 Correct 86 ms 12860 KB Output is correct
5 Correct 87 ms 12872 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 927 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1081 ms 65536 KB Time limit exceeded
2 Halted 0 ms 0 KB -