제출 #654269

#제출 시각아이디문제언어결과실행 시간메모리
654269HanksburgerBaloni (COCI15_baloni)C++17
100 / 100
210 ms3932 KiB
#include <bits/stdc++.h>
using namespace std;
multiset<int> s;
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int n, cnt=0;
    cin >> n;
    for (int i=1; i<=n; i++)
    {
        int x;
        cin >> x;
        auto itr=s.lower_bound(x);
        if (itr!=s.end() && (*itr)==x)
            s.erase(itr);
        else
            cnt++;
        s.insert(x-1);
    }
    cout << cnt;
}
#Verdict Execution timeMemoryGrader output
Fetching results...