Submission #1171594

#TimeUsernameProblemLanguageResultExecution timeMemory
1171594aagiiBaloni (COCI15_baloni)C++20
100 / 100
487 ms69872 KiB
#include <bits/stdc++.h>
// #include "shoes.h"
#define ll long long
#define pb push_back
#define ff first
#define ss second
#define mp make_pair
#define sz size()
#define veg vegeta
#define harderahhh ios::sync_with_stdio(0); cin.tie(0); cout.tie(0)
const int N = 1e9+7;
const int M = 998244353;
using namespace std;
map <ll, ll> wii, waa;
ll n, a[1000005], i, sus;
int main() {
    cin >> n;
    for (i = 1; i <= n; i++) {
        cin >> a[i];
    }
    for (i = 1; i <= n; i++) {
        if (wii[a[i]+1] > 0) {
            wii[a[i]+1]--;
            wii[a[i]]++;
        } else {
            wii[a[i]]++;
        }
    }
    for (i = 1; i <= 1000000; i++) {
        sus += wii[i];
    }
    cout << sus;
    
}
#Verdict Execution timeMemoryGrader output
Fetching results...