Submission #1112371

# Submission time Handle Problem Language Result Execution time Memory
1112371 2024-11-14T06:51:03 Z vjudge1 Baloni (COCI15_baloni) C++17
100 / 100
48 ms 7392 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long 

int32_t main() {
    ios_base::sync_with_stdio(false);
	cin.tie(NULL);cout.tie(NULL);
    int n;
    cin >> n;
    vector<int> balon(n);
    unordered_map<int, int> ok;

    for (int i = 0; i < n; ++i) {
        cin >> balon[i];
    }

    int atis = 0;
    for (int agirlik : balon) {
        if (ok[agirlik] > 0) {
            ok[agirlik]--;
            ok[agirlik - 1]++;
        } else {
            atis++;
            ok[agirlik - 1]++;
        }
    }

    cout << atis << endl;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 47 ms 6728 KB Output is correct
6 Correct 48 ms 7392 KB Output is correct
7 Correct 39 ms 6188 KB Output is correct
8 Correct 38 ms 6112 KB Output is correct
9 Correct 46 ms 6432 KB Output is correct
10 Correct 44 ms 6656 KB Output is correct