답안 #633527

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
633527 2022-08-22T16:53:06 Z Ahmed57 지구 온난화 (NOI13_gw) C++14
19 / 40
1000 ms 65536 KB
#include <bits/stdc++.h>

using namespace std;
int n;
int main(){
    ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    cin>>n;
    vector<long long> v,w,so;v.push_back(2);
    for(int i = 0;i<n;i++){
        int x;cin>>x;
        w.push_back(x);
        so.push_back(x);
    }
    sort(so.begin(),so.end());
    int z = 2;
    map<int,int>cmp;
    for(int i = 0;i<n;i++){
        if(i&&so[i]==so[i-1])z--;
        cmp[so[i]] = z++;
    }
    for(int i = 0;i<n;i++){
        v.push_back(cmp[w[i]]*2);
    }
    long long pre[(cmp[so[n-1]]*2)+1]={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<=cmp[so[n-1]]*2;i++){
        cur+=pre[i];
        ma = max(ma,cur);
    }
    cout<<ma<<"\n";
}
# 결과 실행 시간 메모리 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 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 14 ms 3392 KB Output is correct
2 Correct 15 ms 3400 KB Output is correct
3 Correct 14 ms 3400 KB Output is correct
4 Correct 14 ms 3376 KB Output is correct
5 Correct 18 ms 3392 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 87 ms 9052 KB Output is correct
2 Correct 70 ms 8988 KB Output is correct
3 Correct 78 ms 9044 KB Output is correct
4 Correct 78 ms 9000 KB Output is correct
5 Correct 76 ms 8992 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 546 ms 65536 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1090 ms 55088 KB Time limit exceeded
2 Halted 0 ms 0 KB -