답안 #858479

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
858479 2023-10-08T14:31:06 Z ily2003 Baloni (COCI15_baloni) C++14
100 / 100
43 ms 7508 KB
#include <bits/stdc++.h>
using namespace std;
int n,ans,a[1000001],dp[1000001];
int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cin >> n;
    for (int i=1;i<=n;++i) cin >> a[i];
    for (int i=1;i<=n;++i) {
        if (dp[a[i]]==0) ++ans,++dp[a[i]];
        --dp[a[i]];
        ++dp[a[i]-1];
    }
    cout << ans;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 2392 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2396 KB Output is correct
4 Correct 1 ms 2392 KB Output is correct
5 Correct 42 ms 7104 KB Output is correct
6 Correct 43 ms 7508 KB Output is correct
7 Correct 41 ms 6740 KB Output is correct
8 Correct 35 ms 6480 KB Output is correct
9 Correct 39 ms 6736 KB Output is correct
10 Correct 39 ms 6904 KB Output is correct