Submission #672573

# Submission time Handle Problem Language Result Execution time Memory
672573 2022-12-16T18:26:34 Z sofija6 Baloni (COCI15_baloni) C++14
100 / 100
53 ms 3900 KB
#include <bits/stdc++.h>
#define ll long long
#define MAXH 1000010
using namespace std;
ll cnt[MAXH];
int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n,h,ans=0;
    cin >> n;
    for (ll i=1;i<=n;i++)
    {
        cin >> h;
        cnt[h]++;
        ans++;
        if (cnt[h+1])
        {
            cnt[h+1]--;
            ans--;
        }
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 328 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 52 ms 3900 KB Output is correct
6 Correct 53 ms 3772 KB Output is correct
7 Correct 41 ms 3124 KB Output is correct
8 Correct 40 ms 3124 KB Output is correct
9 Correct 46 ms 3516 KB Output is correct
10 Correct 49 ms 3376 KB Output is correct