32592023-02-23 13:22:15sztomiRészekre (40)cpp11Wrong answer 2/4037ms6608 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int n;
    cin >> n;
    vector<int> a(n);
    for(int& x : a) cin >> x;
    map<int, int> aktiv;
    for(int i = n-1; i >= 0; i--){
        // legnagyobb kisebb
        auto it = aktiv.upper_bound(a[i]);
        if(it != aktiv.end()){
            it->second--;
            if(it->second == 0){
                aktiv.erase(it);
            }
        }
        aktiv[a[i]]++;
/*
        for(auto x : aktiv){
            cout << x.first << " " << x.second << "\n";
        }
        cout << "---------------\n";
*/
    }

    cout << aktiv.size() << "\n";
}
SubtaskSumTestVerdictTimeMemory
base2/40
1Accepted0/03ms1828 KiB
2Accepted0/037ms2832 KiB
3Accepted2/23ms2232 KiB
4Wrong answer0/23ms2316 KiB
5Wrong answer0/23ms2452 KiB
6Wrong answer0/33ms2540 KiB
7Wrong answer0/33ms2664 KiB
8Wrong answer0/34ms3000 KiB
9Wrong answer0/34ms3080 KiB
10Wrong answer0/316ms4272 KiB
11Wrong answer0/324ms5376 KiB
12Wrong answer0/329ms6184 KiB
13Wrong answer0/429ms6504 KiB
14Wrong answer0/429ms6352 KiB
15Wrong answer0/529ms6608 KiB