Submission

Status:

P---------

Subtask/Task Score:

10/100

Score: 10

User: Bunkoblong

Problemset: กองชาม

Language: cpp

Time: 0.017 second

Submitted On: 2025-10-02 00:14:57

#include <iostream>
#include <vector>
#include <set>
#include <algorithm>

void solve() {
    std::ios_base::sync_with_stdio(false);
    std::cin.tie(NULL);

    int N;
    if (!(std::cin >> N)) {
        return; 
    }

    std::multiset<int> tops; 

    for (int i = 0; i < N; ++i) {
        int current_bowl_size;
        if (!(std::cin >> current_bowl_size)) {
            break; 
        }

        auto it = tops.upper_bound(current_bowl_size);

        if (it != tops.end()) {
           
            tops.erase(it);
            
            tops.insert(current_bowl_size);
        } else {
            tops.insert(current_bowl_size);
        }
    }
    std::cout << tops.size() << "\n";
}
int main() {
    solve();
    return 0;
}