답안 #1112383

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1112383 2024-11-14T07:01:34 Z vjudge1 Baloni (COCI15_baloni) C++17
100 / 100
120 ms 7248 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long 

int32_t main() {
    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;
}
# 결과 실행 시간 메모리 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 2 ms 336 KB Output is correct
5 Correct 120 ms 6616 KB Output is correct
6 Correct 117 ms 7248 KB Output is correct
7 Correct 96 ms 5968 KB Output is correct
8 Correct 95 ms 5968 KB Output is correct
9 Correct 106 ms 6400 KB Output is correct
10 Correct 107 ms 6480 KB Output is correct