Submission #582554

# Submission time Handle Problem Language Result Execution time Memory
582554 2022-06-24T05:27:53 Z vuavisao Baloni (COCI15_baloni) C++14
100 / 100
210 ms 4004 KB
#include<bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;

const int N = 1e6 + 10;

int n;

map<int, int> cnt;
int res;

int main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
//    freopen("Baloni.inp", "r", stdin);
//    freopen("Baloni.out", "w", stdout);
    cin >> n;
    for(int i = 1; i <= n; i++)
    {
        int a; cin >> a;
        if(cnt[a + 1])
        {
            cnt[a + 1]--;
        }
        else res++;
        cnt[a]++;
    }
    cout << res;
    return 0;
}

/// Code by vuavisao
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 210 ms 4004 KB Output is correct
6 Correct 210 ms 3916 KB Output is correct
7 Correct 155 ms 3168 KB Output is correct
8 Correct 153 ms 3164 KB Output is correct
9 Correct 181 ms 3568 KB Output is correct
10 Correct 199 ms 3412 KB Output is correct