답안 #154268

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
154268 2019-09-19T19:27:34 Z radugheo Baloni (COCI15_baloni) C++14
100 / 100
354 ms 7392 KB
#include <iostream>

using namespace std;

int n, i, sol, v[1000005], f[1000005];

int main(){
    cin >> n;
    for (i=1; i<=n; i++){
        cin >> v[i];
    }
    for (i=1; i<=n; i++){
        if (f[v[i]+1]){
            f[v[i]+1]--;
        }
        else{
            sol++;
        }
        f[v[i]]++;
    }
    cout << sol;
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 376 KB Output is correct
2 Correct 3 ms 376 KB Output is correct
3 Correct 3 ms 376 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 338 ms 6992 KB Output is correct
6 Correct 354 ms 7392 KB Output is correct
7 Correct 271 ms 6020 KB Output is correct
8 Correct 270 ms 6048 KB Output is correct
9 Correct 303 ms 6520 KB Output is correct
10 Correct 309 ms 6592 KB Output is correct