답안 #590011

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
590011 2022-07-05T13:04:45 Z 0123xx Baloni (COCI15_baloni) C++14
100 / 100
57 ms 3772 KB
#include <bits/stdc++.h>
using namespace std;
int n, ar[1000005], freq[1000005], ans;
int main(){
    ios::sync_with_stdio(false);
    cin.tie(0); cout.tie(0);
    cin >> n;
    for (int i = 1; i<= n; i++){
        cin >> ar[i];
        if (freq[ar[i]+1]){
            freq[ar[i]+1]--;
        }
        else{
            ans++;
        }
        freq[ar[i]]++;
    }
    cout << ans << "\n";
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 0 ms 340 KB Output is correct
3 Correct 0 ms 340 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 51 ms 3412 KB Output is correct
6 Correct 57 ms 3772 KB Output is correct
7 Correct 55 ms 3108 KB Output is correct
8 Correct 42 ms 3020 KB Output is correct
9 Correct 47 ms 3316 KB Output is correct
10 Correct 48 ms 3364 KB Output is correct