답안 #31642

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
31642 2017-08-30T07:53:49 Z bolobalabr Baloni (COCI15_baloni) C++14
100 / 100
93 ms 9988 KB
#include <bits/stdc++.h>

using namespace std;

int n, dd[1000006], a[1000006], res(0);

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n;
    fill(dd + 1, dd + 1000005, 0);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int i = 0; i < n; i++)
    {
        if (dd[a[i] + 1] > 0) dd[a[i] + 1]--;
        else res++;
        dd[a[i]]++;
    }
    cout << res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 9988 KB Output is correct
2 Correct 0 ms 9988 KB Output is correct
3 Correct 0 ms 9988 KB Output is correct
4 Correct 0 ms 9988 KB Output is correct
5 Correct 59 ms 9988 KB Output is correct
6 Correct 73 ms 9988 KB Output is correct
7 Correct 56 ms 9988 KB Output is correct
8 Correct 66 ms 9988 KB Output is correct
9 Correct 93 ms 9988 KB Output is correct
10 Correct 73 ms 9988 KB Output is correct