답안 #898488

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
898488 2024-01-04T18:22:20 Z Blagoj Baloni (COCI15_baloni) C++17
100 / 100
50 ms 484 KB
#include <bits/stdc++.h>

using namespace std;

#define endl '\n'
#define ll long long
#define all(x) (x).begin(), (x).end()

const int mxh = 1e6 + 10;
int cnt[mxh];

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    int n;
    cin >> n;
    int ans = 0;
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        if (!cnt[x]) ans++;
        else cnt[x]--;
        cnt[x - 1]++;
    }
    cout << ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 41 ms 484 KB Output is correct
6 Correct 50 ms 348 KB Output is correct
7 Correct 35 ms 348 KB Output is correct
8 Correct 34 ms 452 KB Output is correct
9 Correct 38 ms 348 KB Output is correct
10 Correct 38 ms 348 KB Output is correct