32562023-02-23 12:43:21TuruTamasRészekre (40)cpp17Time limit exceeded 18/40579ms13640 KiB
#include <bits/stdc++.h>
using namespace std;

vector<stack<int>> x;
int N;

int main() {
    cin >> N;
    int a;
    for (size_t i = 0; i < N; i++)
    {
        cin >> a;
        bool f = false;
        int c = 0;
        for (auto& s : x)
        {
            c++;
            if (s.top() < a) {
                
                s.push(a);
                f = true;
                break;
            }
        }
        if (!f) {
            x.push_back(stack<int>());
            x.back().push(a);
        }
    }
    cout << x.size();
    // for (auto s : x)
    // {
    //     while (!s.empty())
    //     {
    //         cout << s.top() << " ";
    //         s.pop();
    //     }
    //     cout << "\n";
    // }
    
}
SubtaskSumTestVerdictTimeMemory
base18/40
1Accepted0/03ms1688 KiB
2Accepted0/0112ms3720 KiB
3Accepted2/23ms2068 KiB
4Accepted2/23ms2296 KiB
5Accepted2/23ms2788 KiB
6Accepted3/33ms2876 KiB
7Accepted3/36ms3852 KiB
8Accepted3/39ms5372 KiB
9Accepted3/328ms8372 KiB
10Time limit exceeded0/3538ms13420 KiB
11Time limit exceeded0/3579ms13492 KiB
12Time limit exceeded0/3569ms13640 KiB
13Time limit exceeded0/4568ms13556 KiB
14Time limit exceeded0/4564ms13580 KiB
15Time limit exceeded0/5569ms13580 KiB