Submission #964281

# Submission time Handle Problem Language Result Execution time Memory
964281 2024-04-16T14:38:05 Z Pring Baloni (COCI15_baloni) C++17
100 / 100
51 ms 3920 KB
#include <bits/stdc++.h>
using namespace std;

#ifdef MIKU
string dbmc = "\033[1;38;2;57;197;187m", dbrs = "\033[0m";
#define debug(x...) cout << dbmc << "[" << #x << "]: ", dout(x)
void dout() { cout << dbrs << endl; }
template <typename T, typename ...U>
void dout(T t, U ...u) { cout << t << (sizeof...(u) ? ", " : ""); dout(u...); }
#else
#define debug(...) 39
#endif

#define fs first
#define sc second
#define mp make_pair
#define FOR(i, j, k) for (int i = j, Z = k; i < Z; i++)
using ll = long long;
typedef pair<int, int> pii;

const int MXN = 1000005;
int n, a, c[MXN];
int ans;

void miku() {
    cin >> n;
    while (n--) {
        cin >> a;
        if (c[a]) {
            c[a]--;
            c[a - 1]++;
        } else {
            ans++;
            c[a - 1]++;
        }
    }
    cout << ans << '\n';
}

int32_t main() {
    cin.tie(0) -> sync_with_stdio(false);
    cin.exceptions(cin.failbit);
    miku();
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 51 ms 3904 KB Output is correct
6 Correct 44 ms 3920 KB Output is correct
7 Correct 37 ms 3152 KB Output is correct
8 Correct 36 ms 3244 KB Output is correct
9 Correct 43 ms 3508 KB Output is correct
10 Correct 49 ms 3392 KB Output is correct