답안 #839112

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
839112 2023-08-28T16:31:50 Z Bula Baloni (COCI15_baloni) C++14
100 / 100
259 ms 4044 KB
#include <bits/stdc++.h>
using namespace std;

#define ll long long
#define pb push_back
#define all(x) x.begin(),x.end()
#define rall(x) x.rbegin(),x.rend()
#define ff first
#define sc second
#define int ll
const ll mod = 1e9 + 7, N = 1e5 + 1;

main(){
    int n;
    cin >> n;
    map<int, int> mp;
    int ans = 0;
    for(int i = 1; i <= n; i++){
        int x;
        cin >> x;
        mp[x]++;
        if(mp[x + 1] > 0) mp[x + 1] --;
        else ans ++;
    }
    cout << ans << endl;
}

Compilation message

baloni.cpp:13:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   13 | main(){
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 2 ms 340 KB Output is correct
4 Correct 2 ms 340 KB Output is correct
5 Correct 259 ms 4044 KB Output is correct
6 Correct 244 ms 3932 KB Output is correct
7 Correct 178 ms 3188 KB Output is correct
8 Correct 189 ms 3152 KB Output is correct
9 Correct 229 ms 3556 KB Output is correct
10 Correct 223 ms 3424 KB Output is correct