제출 #141428

#제출 시각아이디문제언어결과실행 시간메모리
141428meatrowBaloni (COCI15_baloni)C++17
100 / 100
127 ms7416 KiB
//#pragma GCC optimize("O3")
//#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,abm,mmx,tune=native")
//#pragma GCC optimize ("unroll-loops")
#include <bits/stdc++.h>

using namespace std;

using ll = long long;


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int n;
    cin >> n;
    vector<int> h(n);
    for (int i = 0; i < n; i++) {
        cin >> h[i];
    }
    unordered_map<int, int> a;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        if (a[h[i]]) {
            a[h[i]]--;
        } else {
            ans++;
        }
        a[h[i] - 1]++;
    }
    cout << ans;
    return 0;
}
#Verdict Execution timeMemoryGrader output
Fetching results...