답안 #899027

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
899027 2024-01-05T11:09:58 Z 12345678 Baloni (COCI15_baloni) C++17
100 / 100
47 ms 4040 KB
#include <bits/stdc++.h>

using namespace std;

const int nx=1e6+5;
int n, x, dp[nx], ans;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n;
    for (int i=1; i<=n; i++)
    {
        cin>>x;
        if (dp[x+1]) dp[x+1]--, dp[x]++;
        else dp[x]++, ans++;
    }
    cout<<ans;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 42 ms 4040 KB Output is correct
6 Correct 47 ms 3760 KB Output is correct
7 Correct 38 ms 3152 KB Output is correct
8 Correct 34 ms 3172 KB Output is correct
9 Correct 39 ms 3648 KB Output is correct
10 Correct 40 ms 3408 KB Output is correct